#!/bin/sh # # vanilla: starts and stops vanilla server # # chkconfig: 345 90 10 # description: Netrek is a 16-player graphical real-time battle simulation \ # with a Star Trek theme. # processname:newstartd # pidfile:/var/run/vanilla.pid NAME=vanilla BIN=/usr/games/vanilla/newstartd LOCK=/var/lock/subsys/vanilla PROC=newstartd USER=games # source function library . /etc/rc.d/init.d/functions # source network configuration . /etc/sysconfig/network # abort if no network available [ ${NETWORKING} = "no" ] && exit 0 # abort if no binary available [ -x ${BIN} ] || exit 0 RETVAL=0 start() { echo -n "Starting $NAME: " daemon --user $USER $BIN RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCK } stop() { echo -n "Stopping $NAME: " killproc $PROC RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCK } reload() { echo -n "Reloading $NAME configuration: " killproc $PROC -HUP RETVAL=$? echo } # See how we were called. case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) reload ;; status) status $PROC RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|reload|status}" RETVAL=1 esac exit $RETVAL