5
# control script to stop/start/restart zabbix_suckerd
6
# author: charlie collins
10
# (setup for Red Hat 7.3 with Zabbix 1.0 beta)
11
# (should work for other Red Hat and Sys V style init machines as well)
13
# (modeled after apache style control scripts)
14
# (this script can be placed in init.d and respective runlevel for startup usage)
17
# The exit codes returned are:
18
# 0 - operation completed successfully
21
# 3 - zabbix_suckerd could not be started
22
# 4 - zabbix_suckerd could not be stopped
23
# 5 - zabbix_suckerd could not be started during a restart
24
# 6 - zabbix_suckerd could not be restarted during a restart
33
# (set config options to match your system settings)
38
PIDFILE=/var/tmp/zabbix_suckerd.pid
40
ZABBIX_SUCKERD=$BASEDIR/bin/zabbix_suckerd
44
# logic section (below here) does NOT normally need any modification
50
if [ "x$ARGV" = "x" ] ; then
55
# perform action based on args
58
# check if PIDFILE exists and ensure is not zero size and react accordingly
59
if [ -f $PIDFILE ] && [ -s $PIDFILE ] ; then
61
if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then
62
STATUS="zabbix_suckerd (pid $PID) running"
65
STATUS="zabbix_suckerd (pid $PID?) not running"
69
STATUS="zabbix_suckerd (no pid file) not running"
73
# parse arg and react accordingly
77
if [ $RUNNING -eq 1 ]; then
78
echo "$0 $ARG: zabbix_suckerd (pid $PID) already running"
81
if $ZABBIX_SUCKERD ; then
82
echo "$0 $ARG: zabbix_suckerd started"
84
echo "$0 $ARG: zabbix_suckerd could not be started"
90
if [ $RUNNING -eq 0 ]; then
91
echo "stop called - in running eq 0"
92
echo "$0 $ARG: $STATUS"
96
echo "$0 $ARG: zabbix_suckerd process(es) stopped"
98
echo "$0 $ARG: zabbix_suckerd process(es) could not be stopped"
104
if [ $RUNNING -eq 0 ]; then
105
echo "$0 $ARG: zabbix_suckerd not running, trying to start"
106
if $ZABBIX_SUCKERD ; then
107
echo "$0 $ARG: zabbix_suckerd started"
109
echo "$0 $ARG: zabbix_suckerd could not be started"
114
if $ZABBIX_SUCKERD ; then
115
echo "$0 $ARG: zabbix_suckerd restarted"
117
echo "$0 $ARG: zabbix_suckerd could not be started"
121
echo "$0 $ARG: zabbix_suckerd could not be restarted"
129
echo "usage: $0 (start|stop|restart|help)"
132
start - start zabbix_suckerd
133
stop - stop zabbix_suckerd
134
restart - restart zabbix_suckerd if running by sending a SIGHUP or start if not running