Open necessarily-equal opened 2 years ago
have some form of notification for when (if) it eventually stops updating (e.g. the build breaks)
maybe we can feed the overmind IRC bot with such notice
maybe we can feed the overmind IRC bot with such notice
any idea on how to do that?
For this:
ensure server is empty before restarting
You can use this script (for example name it isServerEmpty
):
#! /usr/bin/env bash
set -e
set -u
if [ -z "${1:-}" ]
then
echo 'ERROR: missing server address' >&2
exit 1
fi
data="$(qstat -raw $'\n' -R -unvanquisheds "${1}" | egrep '^B=|^P=')"
player_count="$(echo "${data}" | egrep '^P=' | cut -c3- | sed -e 's/-//g;s/0//g' | wc -c)"
bot_count="$(echo "${data}" | egrep '^B=' | cut -c3- | sed -e 's/-//g' | wc -c)"
if [ "$((${player_count} - ${bot_count}))" = 0 ]
then
echo "true"
exit
fi
echo "false"
exit 1
You can use it that way:
./isServerEmpty 172.86.178.34:27961
true
Or this way:
if ./isServerEmpty 172.86.178.34:27961 >/dev/null; then echo "let's do it"; fi
let's do it
On the server you'll probably want to address localhost
or 127.0.0.1
.
You'll also prefer to have a fixed port. 27961
looks to be basically the “next one” after 27960
which is used by the vanilla server. I would prefer if you use a port that is not in the immediate following of 27960
because we may spawn more vanilla servers if needed (like I did at 0.52.0
release time), so it's better if optional extra servers don't steal the port of the nightly one.
For example, what if you set 27959
for the nightly server? Extra servers will never claim this port automatically.
For the script to work you will need qstat
: https://github.com/Unity-Technologies/qstat
Note: on the server you can use quakestat -raw $'\n' -R -tremulous "${1}"
instead of qstat -raw $'\n' -R -unvanquisheds "${1}"
but maybe you'll want to add qstat to your nix stuff and get recent qstat instead.
ToDo:
and packageassets (I've given up on handling assets in nix)