文章目录
#!/bin/sh
#
# Scribed     Startup script for the scribe daemon
#
# chkconfig: - 83 13
# description: Scribed.
#
# processname: scribed
# config: /etc/scribe/scribed.conf
# pidfile: /var/run/scribed.pid
#

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

if [ -f /etc/sysconfig/scribed ]; then
        . /etc/sysconfig/scribed
fi

if [ -z "$SCRIBED_CONF_PATH" ]; then
        SCRIBED_CONF_PATH="/etc/scribed/scribed.relay.conf"
fi

prog="scribed"
lockfile="/var/lock/subsys/$prog"
scribed="/usr/sbin/scribed"
scribe_ctrl="/usr/sbin/scribe_ctrl"
RETVAL=0

start() {
        echo -n $"Starting $prog: "
        $scribed -c $SCRIBED_CONF_PATH > /dev/null 2>&1 &
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                success
                touch $lockfile
        fi
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc $scribed
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        return $RETVAL
}

status() {
        $scribe_ctrl status
}

case "$1" in
        start)  
                start
                ;;
        stop)   
                stop
                ;;
        restart)
                stop
                start
                ;;
        status) 
                status
                ;;
        *)      
                echo $"Usage: $0 {start|stop|restart|status}"
                RETVAL=1
esac

exit $RETVAL 
文章目录