Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 0b592d17c60eb61e4262cb91d7acfe48 > files > 3

sobby-0.4.7-2mdv2010.1.src.rpm

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: sobby
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: standalone obby server
# Description: A standalone obby server
#              A collaborative editor server
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

DAEMON_NAME=sobby
DAEMON_PROCESS=sobby
DAEMON_BINARY=/usr/bin/sobby
DAEMON_CONF=/etc/sobby.conf
DAEMON_USER=sobby
LOCK_FILE=/var/lock/subsys/$DAEMON_NAME
RETVAL=0

[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME

start() {
    [ -f $LOCK_FILE ] && return

    gprintf "Starting %s: " $DAEMON_NAME
    daemon --user $DAEMON_USER "($DAEMON_BINARY -c $DAEMON_CONF 2>&1 | /bin/logger -t $DAEMON_PROCESS ) &"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCK_FILE
}

stop() {
    gprintf "Shutting down %s: " $DAEMON_NAME
    killproc $DAEMON_PROCESS
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status $DAEMON_PROCESS
        RETVAL=$?
        ;;
    restart|reload)
        stop
        start
        ;;
    condrestart)
        if [ -f $LOCK_FILE ]; then
            stop
            start
        fi
        ;;
    *)
        gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$0"
        RETVAL=1
esac

exit $RETVAL