SSPU init script


SSPU init script
 
#!/bin/sh
#
#agent init script
#chkconfig: 2345 98 05
#description: sspu
# Source function library.
if [ -f /etc/init.d/functions ] ; then
        . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
        . /etc/rc.d/init.d/functions
else
        exit 0
fi
 
prog=ssp
APP_HOME=/apps/$prog
AGENT_USER=user1
 
start () {
        echo -n $"Starting $prog: "
 
        # start daemon
        su - ${AGENT_USER} -c "cd ${APP_HOME}; ./cns.oracle.sh &> /dev/null &"
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}
 
stop () {
        # stop daemon
        echo -n $"Stopping $prog: "
        ssppid=`pgrep -f cns.oracle.config`;kill -9 $ssppid
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
        return $RETVAL
}
 
restart() {
        stop
        start
}
 
case $1 in
        start)
                start
        ;;
        stop)
                stop
        ;;
        restart|reload)
                restart
        ;;
        condrestart)
                [ -f /var/lock/subsys/$prog ] && restart || :
        ;;
        *)
 
        echo $"Usage: $prog {start|stop|restart|condrestart|reload }"
        exit 1
esac
 
exit $RETVAL

No comments: