728x90
반응형
#!/bin/sh
#
# chkconfig: - 86 14
# description: J2 agent daemon
# processname: j2-monitoring-agent
#
#
### BEGIN INIT INFO
# Provides: J2 agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop j2 agent
# Description: j2 monitoring agent
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/local/bin/j2-monitoring-agent ]; then
exec=/usr/local/bin/j2-monitoring-agent
else
exit 5
fi
result=`ps -ef | grep j2-monitoring-agent | grep -v grep | uniq | wc -l`
prog=${exec}
start()
{
if [ $result -eq 1 ]; then echo "j2 agent started already" ; else daemon $exec ; fi
}
stop()
{
if [ $result -eq 0 ]; then echo "j2 agent exited already" ; else echo "Shutting down j2 agent: " ; killproc $prog ; fi
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0} does not support the reload action: " /bin/false
exit 3
;;
*)
#
# chkconfig: - 86 14
# description: J2 agent daemon
# processname: j2-monitoring-agent
#
#
### BEGIN INIT INFO
# Provides: J2 agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop j2 agent
# Description: j2 monitoring agent
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/local/bin/j2-monitoring-agent ]; then
exec=/usr/local/bin/j2-monitoring-agent
else
exit 5
fi
result=`ps -ef | grep j2-monitoring-agent | grep -v grep | uniq | wc -l`
prog=${exec}
start()
{
if [ $result -eq 1 ]; then echo "j2 agent started already" ; else daemon $exec ; fi
}
stop()
{
if [ $result -eq 0 ]; then echo "j2 agent exited already" ; else echo "Shutting down j2 agent: " ; killproc $prog ; fi
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0} does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
;;
esac
exit 2
;;
esac
반응형
'엔지니어 > C++' 카테고리의 다른 글
agent server makefile (create by sk) (0) | 2016.05.26 |
---|---|
agent client makefile (create by sk) (0) | 2016.05.26 |
j2-agent.spec (create by sk) (0) | 2016.05.26 |
rpmbuild sh (create by sk) (0) | 2016.05.26 |
agent client makefile 32bit (create by sk) (0) | 2016.05.26 |