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

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

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

Revision 1.1 by jpp, Thu May 14 03:29:51 2020 UTC Revision 1.2 by jpp, Thu May 14 03:38:46 2020 UTC
# Line 1  Line 1 
1  #! /bin/sh  #!/bin/sh
2  #  #
3  # chkconfig: - 85 15  # chkconfig: - 86 14
4  # description: zabbix agent daemon  # description: Zabbix agent daemon
5    # processname: zabbix_agentd
6    # config: /etc/zabbix/zabbix_agentd.conf
7  #  #
8    
9  ### BEGIN INIT INFO  ### BEGIN INIT INFO
10  # Provides: zabbix-agent  # Provides: zabbix-agent
11  # Required-Start: $local_fs $network  # Required-Start: $local_fs $network
12  # Required-Stop: $local_fs $network  # Required-Stop: $local_fs $network
13    # Should-Start: zabbix zabbix-proxy
14    # Should-Stop: zabbix zabbix-proxy
15  # Default-Start:  # Default-Start:
16  # Default-Stop: 0 1 2 3 4 5 6  # Default-Stop: 0 1 2 3 4 5 6
17  # Short-Description: start and stop zabbix agent  # Short-Description: Start and stop Zabbix agent
18  # Description: Zabbix Agent  # Description: Zabbix agent
19  ### END INIT INFO  ### END INIT INFO
20    
 # zabbix details  
 ZABBIX_AGENTD=/usr/sbin/zabbix_agentd  
 CONF=/etc/zabbix/zabbix_agentd.conf  
 PIDFILE=/var/run/zabbix-agent.pid  
   
21  # Source function library.  # Source function library.
22  . /etc/rc.d/init.d/functions  . /etc/rc.d/init.d/functions
23    
24  # Source networking configuration.  if [ -x /usr/sbin/zabbix_agentd ]; then
25  . /etc/sysconfig/network      exec=/usr/sbin/zabbix_agentd
26    else
27  # Check that networking is up.      exit 5
28  [ ${NETWORKING} = "no" ] && exit 0  fi
29    
30  [ -x $ZABBIX_AGENTD ] || exit 5  prog=${exec##*/}
31  [ -e $CONF ] || exit 6  conf=/etc/zabbix/zabbix_agentd.conf
32    pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
33  RETVAL=0  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    
73  case "$1" in  case "$1" in
74      start)      start|stop|restart)
75          echo -n "Starting zabbix agent: "          $1
         daemon $ZABBIX_AGENTD -c $CONF  
         RETVAL=$?  
         echo  
         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix-agent  
76          ;;          ;;
77      stop)      force-reload)
78          echo -n "Shutting down zabbix agent: "          restart
         killproc zabbix_agentd  
         RETVAL=$?  
         echo  
         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix-agent  
         ;;  
     restart|reload)  
         $0 stop  
         $0 start  
         RETVAL=$?  
79          ;;          ;;
80      status)      status)
81          status zabbix_agentd          status -p $pidfile $prog
82          RETVAL=$?          ;;
83        try-restart|condrestart)
84            if status $prog >/dev/null ; then
85                restart
86            fi
87            ;;
88        reload)
89            action $"Service ${0##*/} does not support the reload action: " /bin/false
90            exit 3
91          ;;          ;;
92      *)      *)
93          echo "Usage: $0 {start|stop|restart|reload|status}"          echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
94          exit 1          exit 2
95          ;;          ;;
96  esac  esac
97    
 exit $RETVAL  
   


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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