3 # Starts the zabbix_agent2 daemon
7 # description: zabbix_agent2 long service description
9 # processname: zabbix_agent2
11 # Source function library
12 . /etc/rc.d/init.d/functions
15 . /etc/sysconfig/network
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20 msg_network_down "Zabbix Agent 2"
29 # Get service config - may override defaults
30 [ -f /etc/sysconfig/zabbix_agent2 ] && . /etc/sysconfig/zabbix_agent2
32 # Try to get configured PidFile or set default
36 test -f "$config" && pidfile=$(awk -F= '/^ *PidFile/ {print $2}' "$config")
37 # Fallback to zabbix_agent2 default pidfile
38 test -n "$pidfile" || pidfile=/tmp/zabbix_agent2.pid
42 pidfile=$(get_pid /etc/zabbix/zabbix_agent2.conf)
45 # Check if the service is already running?
46 if [ -f /var/lock/subsys/zabbix_agent2 ]; then
47 msg_already_running "Zabbix Agent 2"
51 msg_starting "Zabbix Agent 2"
52 daemon --fork --user $ZABBIX_USER /usr/sbin/zabbix_agent2
54 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_agent2
58 if [ ! -f /var/lock/subsys/zabbix_agent2 ]; then
59 msg_not_running "Zabbix Agent 2"
64 msg_stopping "Zabbix Agent 2"
65 killproc --pidfile $pidfile zabbix_agent2 -TERM
66 rm -f /var/lock/subsys/zabbix_agent2
70 if [ ! -f /var/lock/subsys/zabbix_agent2 ]; then
71 msg_not_running "Zabbix Agent 2"
81 # See how we were called.
100 status --pidfile $pidfile zabbix_agent2
104 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"