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