Add arkCpuAffinity setting

This commit is contained in:
Ben Peddell 2016-10-02 12:23:21 +10:00
parent 992baeb23a
commit 60465a178a
2 changed files with 16 additions and 3 deletions

View File

@ -407,6 +407,11 @@ The following options can be overridden on a per-instance basis:
Negative values give a higher priority, and positive values give a lower priority. Negative values give a higher priority, and positive values give a lower priority.
Requires `sudo` and `renice` Requires `sudo` and `renice`
`arkCpuAffinity`::
Attempts to set the CPU affinity of the ARK server.
Setting is a comma-delimited list of processor indices on which the server should run.
Requires `sudo` and `taskset`
`msgWarnUpdateMinutes`:: `msgWarnUpdateMinutes`::
`msgWarnUpdateSeconds`:: `msgWarnUpdateSeconds`::
`msgWarnRestartMinutes`:: `msgWarnRestartMinutes`::

View File

@ -1030,15 +1030,23 @@ doStart() {
echo "The server is starting..." echo "The server is starting..."
local pid=$! local pid=$!
if [ -n "$arkPriorityBoost" ]; then if [[ -n "$arkPriorityBoost" || -n "$arkCpuAffinity" ]]; then
doRun --wait </dev/null >>"$logdir/$arkserverLog" 2>&1 & # output of this command is logged doRun --wait </dev/null >>"$logdir/$arkserverLog" 2>&1 & # output of this command is logged
local pid="$!" local pid="$!"
# Wait for monitor process to suspend itself # Wait for monitor process to suspend itself
wait wait
echo "Boosting priority of ark server" if [ -n "$arkPriorityBoost" ]; then
sudo renice -n "$arkPriorityBoost" "$pid" echo "Boosting priority of ark server"
sudo renice -n "$arkPriorityBoost" "$pid"
fi
if [ -n "$arkCpuAffinity" ]; then
echo "Setting CPU affinity for ark server"
sudo taskset -c "$arkCpuAffinity" -p "$pid"
fi
kill -CONT "$pid" kill -CONT "$pid"
else else
doRun </dev/null >>"$logdir/$arkserverLog" 2>&1 & # output of this command is logged doRun </dev/null >>"$logdir/$arkserverLog" 2>&1 & # output of this command is logged