/usr/games/armagetronad-dedicated is in armagetronad-dedicated 0.2.8.3.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #!/bin/bash -e
REALTRON=/usr/games/armagetronad-dedicated.real
DATADIR=/usr/share/games/armagetronad
CONFDIR=/etc/armagetronad
# Source configuration variables.
. /etc/default/armagetronad-dedicated
CMDLINE="--datadir $DATADIR --configdir $CONFDIR --userdatadir $VARDIR -d"
# Array for keeping track of start times.
declare -a STARTDATE_LOG
function run()
{
exec $REALTRON $CMDLINE $* &
echo `jobs -p` > $MAINPIDFILE
wait
echo Terminated
}
function run_continuous()
{
echo $$ > $STARTERPIDFILE
while true; do
STARTDATE=`date +%s`
run
# Give up if restarts come too quickly; ten per minute is suspicious.
OLDESTART=${STARTDATE_LOG[1]}
if [ ! -z "$OLDESTSTART" ]; then
TIMESPENT=$(($STARTDATE - $OLDESTSTART))
if [ ${TIMESPENT} -lt 60]; then
echo "Stopping server, it is restarting too quickly."
rm -f $STARTERPIDFILE
rm -f $MAINPIDFILE
exit
fi
fi
# Keep log of past start dates.
for f in 1 2 3 4 5 6 7 8 9; do
next=$(( $f + 1))
STARDATE_LOG[$f]=${STARTDATE_LOG[$next]}
done
STARTDATE_LOG[10]=${STARTDATE}
done
}
# Still allow other arguments to be executed, e.g. --doc
if [ "$1" != "" ]; then
exec $REALTRON $CMDLINE $1 $2 $3
exit 0
fi
# Run and keep-alive in case of crashes.
run_continuous
|