Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 6dad36cb60e267f82fe69d929f7a4a46 > files > 3

vanilla-2.9pl7-2mdk.i586.rpm

#!/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