#!/bin/sh # # liquidwar This shell script takes care of starting and stopping # the liquidwar game server. # # chkconfig: - 15 85 # description: The liquidwar server supports playing networked \ # multi-player games. # processname: liquidwar-server # config: /etc/sysconfig/liquidwar # pidfile: /var/run/liquidwar-server.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 exec="/usr/bin/liquidwar-server" prog=$(basename $exec) name=liquidwar pidfile=/var/run/$prog.pid [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/$prog start() { echo -n $"Starting liquidwar game server: " if [ -n "`/sbin/pidof $prog`" ]; then echo -n $"$prog already running" failure echo return 1 fi # This doesn't properly detect startup failures daemon --user liquidwar $exec $LIQUIDWAR_OPTIONS >>/var/log/${prog}.log 2>&1 & retval=$? if [ $retval -eq 0 ]; then success touch $lockfile else failure fi echo return $retval } stop() { echo -n $"Stopping liquidwar game server: " killproc $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { stop start } reload() { restart } force_reload() { restart } fdr_status() { status $prog } case "$1" in start|stop|restart|reload) $1 ;; force-reload) force_reload ;; status) fdr_status ;; condrestart|try-restart) [ ! -f $lockfile ] || restart ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" exit 2 esac