enemy-territory/enemy-territory-initscript

70 lines
1.7 KiB
Bash

#!/bin/sh
#
# et runs enemy-territory server
#
# chkconfig: 2345 85 15
# description: Starts and stops the enemy-territory server
LOCKFILE=/var/lock/subsys/et
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Source et server configuration.
. /etc/sysconfig/etserver
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
# See how we were called.
case "$1" in
start)
# Start daemon
[ "VM_GAME" ] && ETDED_OPTS="+set vm_game $VM_GAME"
[ "NET_PORT" ] && ETDED_OPTS="$ETDED_OPTS +set net_port $NET_PORT"
[ "COM_HUNKMEGS" ] && ETDED_OPTS="$ETDED_OPTS +set com_hunkmegs $COM_HUNKMEGS"
[ "COM_ZONEMEGS" ] && ETDED_OPTS="$ETDED_OPTS +set com_zonemegs $COM_ZONEMEGS"
[ "GAME_MOD" ] && ETDED_OPTS="$ETDED_OPTS +set fs_game $GAME_MOD"
[ "SERVER_TYPE" ] && ETDED_OPTS="$ETDED_OPTS +set dedicated $SERVER_TYPE"
[ "FS_BASEPATH" ] && ETDED_OPTS="$ETDED_OPTS +set fs_basepath $FS_BASEPATH"
[ "SV_PUNKBUSTER" ] && ETDED_OPTS="$ETDED_OPTS +set sv_punkbuster $SV_PUNKBUSTER"
[ "SERVER_CONFIG" ] && ETDED_OPTS="$ETDED_OPTS +exec $SERVER_CONFIG"
gprintf "Starting enemy-territory server: "
daemon --user et $ETDED $ETDED_OPTS &
echo
touch $LOCKFILE
;;
stop)
# Stop daemon
gprintf "Shutting down enemy-territory server: "
killproc etded
echo
rm -f $LOCKFILE
;;
status)
status etded
;;
restart)
$0 stop
$0 start
;;
reload)
$0 stop
$0 start
;;
condrestart)
if [ -f $LOCKFILE ]; then
$0 stop
$0 start
fi
;;
*)
gprintf "Usage: $0 {start|stop|restart|status}\n"
exit 1
esac
exit 0