]> git.pld-linux.org Git - packages/zabbix.git/blame - zabbix_agentd.init
up to 6.0.29
[packages/zabbix.git] / zabbix_agentd.init
CommitLineData
d93a02f8
ER
1#!/bin/sh
2#
3# Starts the zabbix_agentd daemon
4#
5# chkconfig: 345 95 5
6#
7# description: zabbix_agentd long service description
8#
9# processname: zabbix_agentd
10# processname: zabbix_agentd
11
12# Source function library
13. /etc/rc.d/init.d/functions
14
15# Get network config
16. /etc/sysconfig/network
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21 msg_network_down "Zabbix Agent"
22 exit 1
23 fi
24else
25 exit 0
26fi
27
28# Get service config - may override defaults
29[ -f /etc/sysconfig/zabbix_agentd ] && . /etc/sysconfig/zabbix_agentd
30
31pidfile="/var/run/zabbix/zabbix_agentd.pid"
32
33start() {
34 # Check if the service is already running?
35 if [ -f /var/lock/subsys/zabbix_agentd ]; then
36 msg_already_running "Zabbix Agent"
37 return
38 fi
39
40 msg_starting "Zabbix Agent"
41 daemon /usr/sbin/zabbix_agentd
42 RETVAL=$?
43 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_agentd
44}
45
46stop() {
47 if [ ! -f /var/lock/subsys/zabbix_agentd ]; then
48 msg_not_running "Zabbix Agent"
49 return
50 fi
51
52 # Stop daemons.
53 msg_stopping "Zabbix Agent"
54 killproc --pidfile $pidfile zabbix_agentd -TERM
55 rm -f /var/lock/subsys/zabbix_agentd
56}
57
58condrestart() {
59 if [ ! -f /var/lock/subsys/zabbix_agentd ]; then
60 msg_not_running "Zabbix Agent"
61 RETVAL=$1
62 return
63 fi
64
65 stop
66 start
67}
68
69RETVAL=0
70# See how we were called.
71case "$1" in
72 start)
73 start
74 ;;
75 stop)
76 stop
77 ;;
78 restart)
79 stop
80 start
81 ;;
82 try-restart)
83 condrestart 0
84 ;;
85 force-reload)
86 condrestart 7
87 ;;
88 status)
89 status --pidfile $pidfile zabbix_agentd
90 RETVAL=$?
91 ;;
92 *)
93 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
94 exit 3
95esac
96
97exit $RETVAL
This page took 0.576096 seconds and 4 git commands to generate.