#!/bin/sh # # /etc/rc.d/init.d/crossfire # # Starts crossfire as a gameserver. # # chkconfig: 345 99 1 # description: Server for Crossfire, a nethack/Gauntlet(TM) type \ # game for X Windows. # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 start() { echo -n 'Starting crossfire server: ' daemon --user games /usr/games/crossfire -d -detach -log /var/log/crossfire/crossfire.log RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crossfire echo return $RETVAL } stop() { echo -n 'Stopping crossfire server: ' killproc crossfire RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/crossfire return $RETVAL } # # See how we were called. # case "$1" in start) start ;; stop) stop ;; reload|restart) stop [ $RETVAL -eq 0 ] && { sleep 3; start; } ;; status) status /usr/games/crossfire ;; condrestart) [ -f /var/lock/subsys/crossfire ] && restart ;; *) gprintf "Usage: /etc/rc.d/init.d/crossfire {start|stop|restart|reload|status|condrestart}\n" exit 1 esac exit $RETVAL