Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 91212b4688eb1870d53b39cb748d4eeb > files > 1

xsw1.34-server-1.34.0-3mdk.i586.rpm

#!/bin/sh
#
# swserv: starts and stops swserv daemon
#
# chkconfig: 345 90 10
# description: The swserv daemon manages XShipWars connections, which are used by \
#              xsw game clients. The server is required if clients will \
#              make use of the local machine as a universe server.
# processname: swserv
# pidfile: /var/run/swserv.pid
NAME=swserv
BIN=/usr/sbin/swserv1.34
CONFDIR=/etc/swserv1.34
LOCK=/var/lock/subsys/swserv1.34
PROC=swserv
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: "
    # start a server process for each config file available
    for conf in $CONFDIR/*; do
        daemon --user $USER $BIN $conf
	let "RETVAL |= $?"
    done
    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