By the way, are there any plans to improve the server software for the new influx of players? It would be great if there was an option to tell the server that it should shutdown itself once all players left the server. Occasionally I host some servers (the game definitely needs more), and it can be a huge pain to find a good moment to shut the servers down again without disturbing players. On Linux, the terminal title sadly does not show how many players are connected. Thanks!
Personally I have a cron on linux that shutdown the server if he is empty & older than a day.
Bash:
#!/bin/bash
mapfile -t array < <( ps -aux |grep -oh Queryport=[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]])
for i in "${array[@]}"
do
pid=$( echo `ps -aux |grep Queryport=${i:10} |grep -v grep` | awk '{print $2}' | cut -d' ' -f 1 )
age=$( echo `ps -p $pid -o etimes` |cut -d' ' -f 2 )
if [[ $age -gt 86400 ]]; then #24h = 86400 secondes
test=`gamedig --type killingfloor2 --host 127.0.0.1 --port ${i:10} | jq .raw.rules.bInProgress`
if [[ "$test" = "\"False\"" ]]; then
kill $pid
echo "Server kill :" $pid
else
echo "Game in progress" ${i:10} "// Server time:" `expr $age / 3600`"h"
fi
fi
done
Then another cron check for servers & scripts that need to be restarted.
Last edited:
Upvote
0