SSPU Client init script
#!/bin/sh
#
#agent init script
#chkconfig: 2345 98 05
#description: sspc
# 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
#
#agent init script
#chkconfig: 2345 98 05
#description: sspc
# 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
APP_HOME=/apps/$prog
AGENT_USER=user1
start () {
echo -n $"Starting $prog: "
echo -n $"Starting $prog: "
# start daemon
su - ${AGENT_USER} -c "cd ${APP_HOME}; ./sub_agent.sh &> /dev/null &"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
su - ${AGENT_USER} -c "cd ${APP_HOME}; ./sub_agent.sh &> /dev/null &"
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop () {
# stop daemon
echo -n $"Stopping $prog: "
ssppid=`pgrep -f sub_agent`;kill -9 $ssppid
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
# stop daemon
echo -n $"Stopping $prog: "
ssppid=`pgrep -f sub_agent`;kill -9 $ssppid
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
restart() {
stop
start
}
stop
start
}
case $1 in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
*)
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 1
esac
exit $RETVAL
No comments:
Post a Comment