/[smecontribs]/rpms/zabbix/contribs9/zabbix-agent.init
ViewVC logotype

Annotation of /rpms/zabbix/contribs9/zabbix-agent.init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Thu May 14 03:38:46 2020 UTC (4 years, 5 months ago) by jpp
Branch: MAIN
CVS Tags: zabbix-4_4_6-2_el6_sme, zabbix-4_4_6-1_el6_sme, zabbix-4_4_6-1_el6, HEAD
Changes since 1.1: +73 -43 lines
import

1 jpp 1.2 #!/bin/sh
2 jpp 1.1 #
3 jpp 1.2 # chkconfig: - 86 14
4     # description: Zabbix agent daemon
5     # processname: zabbix_agentd
6     # config: /etc/zabbix/zabbix_agentd.conf
7 jpp 1.1 #
8    
9     ### BEGIN INIT INFO
10     # Provides: zabbix-agent
11     # Required-Start: $local_fs $network
12     # Required-Stop: $local_fs $network
13 jpp 1.2 # Should-Start: zabbix zabbix-proxy
14     # Should-Stop: zabbix zabbix-proxy
15 jpp 1.1 # Default-Start:
16     # Default-Stop: 0 1 2 3 4 5 6
17 jpp 1.2 # Short-Description: Start and stop Zabbix agent
18     # Description: Zabbix agent
19 jpp 1.1 ### END INIT INFO
20    
21     # Source function library.
22     . /etc/rc.d/init.d/functions
23    
24 jpp 1.2 if [ -x /usr/sbin/zabbix_agentd ]; then
25     exec=/usr/sbin/zabbix_agentd
26     else
27     exit 5
28     fi
29    
30     prog=${exec##*/}
31     conf=/etc/zabbix/zabbix_agentd.conf
32     pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
33     timeout=10
34    
35     if [ -f /etc/sysconfig/zabbix-agent ]; then
36     . /etc/sysconfig/zabbix-agent
37     fi
38    
39     if [ -n "$ZABBIX_AGENT_USER" ]; then
40     user_conf="--user=$ZABBIX_AGENT_USER"
41     else
42     user_conf=''
43     fi
44    
45     lockfile=/var/lock/subsys/zabbix-agent
46    
47     start()
48     {
49     echo -n $"Starting Zabbix agent: "
50     daemon $user_conf $exec -c $conf
51     rv=$?
52     echo
53     [ $rv -eq 0 ] && touch $lockfile
54     return $rv
55     }
56    
57     stop()
58     {
59     echo -n $"Shutting down Zabbix agent: "
60     killproc -p $pidfile -d $timeout $prog
61     rv=$?
62     echo
63     [ $rv -eq 0 ] && rm -f $lockfile
64     return $rv
65     }
66    
67     restart()
68     {
69     stop
70     start
71     }
72 jpp 1.1
73     case "$1" in
74 jpp 1.2 start|stop|restart)
75     $1
76 jpp 1.1 ;;
77 jpp 1.2 force-reload)
78     restart
79 jpp 1.1 ;;
80 jpp 1.2 status)
81     status -p $pidfile $prog
82     ;;
83     try-restart|condrestart)
84     if status $prog >/dev/null ; then
85     restart
86     fi
87 jpp 1.1 ;;
88 jpp 1.2 reload)
89     action $"Service ${0##*/} does not support the reload action: " /bin/false
90     exit 3
91 jpp 1.1 ;;
92     *)
93 jpp 1.2 echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
94     exit 2
95 jpp 1.1 ;;
96     esac
97    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed