Crossfire Server, Branch 1.12  R12190
init.d
Go to the documentation of this file.
00001 #! /bin/sh
00002 #
00003 # This file was automatically customized by debmake on Sun, 11 Oct 1998 18:12:42 -0700
00004 #
00005 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
00006 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
00007 # Modified for Debian by Christoph Lameter <clameter@debian.org>
00008 
00009 PATH=/bin:/usr/bin:/sbin:/usr/sbin
00010 DAEMON=/usr/games/crossfire
00011 # The following value is extracted by debstd to figure out how to generate
00012 # the postinst script. Edit the field to change the way the script is
00013 # registered through update-rc.d (see the manpage for update-rc.d!)
00014 FLAGS="defaults 50"
00015 
00016 test -f $DAEMON || exit 0
00017 
00018 umask 002
00019 
00020 case "$1" in
00021   restart|force-reload)
00022     start-stop-daemon --stop --verbose --exec $DAEMON
00023     echo -n "waiting a bit for the server to stop"
00024     count=0
00025     while test "`ps aux|grep /usr/games/crossfire|wc -l`" -gt 1 
00026         do
00027         count=`expr $count + 1`
00028         if [ $count -gt 30 ]
00029             then
00030             echo -n "crossfire not ready, not waiting any longer..."
00031             break
00032         fi
00033         echo -n "."
00034         sleep 1
00035     done
00036     echo
00037     start-stop-daemon --start --chuid games:games --verbose --exec $DAEMON -- -detach
00038     ;;
00039   start)
00040     start-stop-daemon --start --chuid games:games --verbose --exec $DAEMON -- -detach
00041     ;;
00042   stop)
00043     start-stop-daemon --stop --verbose --exec $DAEMON
00044     ;;
00045   *)
00046     echo "Usage: /etc/init.d/crossfire {start|stop|restart}"
00047     exit 1
00048     ;;
00049 esac
00050 
00051 exit 0