Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 0a0afdca06ee6b190babf637edda95cd > files > 4

sixad-1.5.1-2mdv2010.2.i586.rpm

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: sixad
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: nothing
# Description: sixad is nothing.
#              Really, nothing.
### END INIT INFO

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

DAEMON_NAME=sixad
DAEMON_PROCESS=sixad
DAEMON_BINARY=sixad
LOCK_FILE=/var/lock/subsys/$DAEMON_NAME
RETVAL=0

# default option, they can be overriden in /etc/sysconfig/$DAEMON_NAME
# of course, you can place what you want.
OPTIONS=
PORT=1234
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME


start() {
    # if you cannot start the daemon since something is missing ( like a path that cannot be set by default
    # , place the test here
    # if [ -z "$SOME_VAR" ]; then
    #     gprintf "You need to set %s in /etc/sysconfig/%s\n" "$SOME_VAR" "$DAEMON_NAME"
    #     RETVAL=1
    #     return
    # fi

    [ -f $LOCK_FILE ] && return

    gprintf "Starting %s: " "$DAEMON_NAME"
    # use --user to run the daemon under the specified uid
    daemon $DAEMON_BINARY $OPTIONS
    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
}

reload() {
    gprintf "Reloading %s configuration: " "$DAEMON_NAME"
    killproc $DAEMON_PROCESS -HUP
    RETVAL=$?
    echo
}

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

exit $RETVAL