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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#! /bin/sh
#
### This script has been patched from it's original source for
# distribution to Debian systems. The original script can be viewed and
# checked out from SVN.
# AA Server Cron Job (originally TeamSpeak Cron Job)
#
# Usage: alien-arena-server -s <configfile>
# EG: alien-arena-server -s ctf.cfg
#
# Author: Chris Childers
# E-Mail: Chris@darkstarllc.com
# Modified by: Fafa Paku
# Modified by: Tony Jackson
# Updated for Alien Arena 2011
# 2010-12-04 FIXME: could benefit from some documentation.
# Debian patch by: Andres Mejia <mcitadel@gmail.com>
#
# Set the port number in the .cfg if running multiple servers.
# Script checks the existance of the cfg file before launching.
# Uncomment this line if you want to get core dumps
#ulimit -c unlimited
### Set your default AA Root Directory
if [ $COR_GAME ] ; then
aadir=$COR_GAME
else
aadir=$HOME/.local/share/cor-games
fi
### Set your AA Binary Name or command string ($1 is the argument
### passed to the script)
aabin="/usr/lib/games/alien-arena/alienarena-ded +set game arena +exec $1"
########## you probably don't need to change anything below here
##########
if [ $1 ]
then
if test -r $aadir/arena/$1
then
echo "Found server config $aadir/arena/$1..."
else
echo "Unable to find server config $aadir/arena/$1."
exit 0
fi
else
echo "Usage: alien-arena-server -s <configfile>\n\
<configfile> must be specified.\n\
<configfile> can be placed inside $HOME/.config/alien-arena and\n\
specified by its basename, or it can be specified by its full path.\n\n"
exit 0
fi
aapid="$1.pid"
cd $aadir
# is there a pid file?
if test -r $aapid
then
# there is a pid file -- is it current?
pid=`cat $aapid`
if `kill -CHLD $pid >/dev/null 2>&1`
then
echo "Alien Arena is currently running...."
exit 0
fi
echo ""
echo "Stale $aapid file, erasing..."
echo "Attempting to Restart Alien Arena"
rm -f $aapid
$aabin &
ps aux | grep "$aabin" | grep -v grep | awk '{print $2}' > $aapid
else
echo "$aapid appears to be missing. Attempting to Restart Alien Arena"
$aabin &
ps aux | grep "$aabin" | grep -v grep | awk '{print $2}' > $aapid
fi
|