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.
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`::
`msgWarnUpdateSeconds`::
`msgWarnRestartMinutes`::

View File

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