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

Diff of /rpms/zabbix/contribs9/zabbix-server.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:52 2020 UTC Revision 1.2 by jpp, Thu May 14 03:38:49 2020 UTC
# Line 1  Line 1 
1  #! /bin/sh  #!/bin/sh
2  #  #
3  # chkconfig: - 85 15  # chkconfig: - 85 15
4  # description: zabbix server daemon  # description: Zabbix server daemon
5    # config: /etc/zabbix/zabbix_server.conf
6  #  #
7    
8  ### BEGIN INIT INFO  ### BEGIN INIT INFO
# Line 10  Line 11 
11  # Required-Stop: $local_fs $network  # Required-Stop: $local_fs $network
12  # Default-Start:  # Default-Start:
13  # Default-Stop: 0 1 2 3 4 5 6  # Default-Stop: 0 1 2 3 4 5 6
14  # Short-Description: start and stop zabbix server  # Short-Description: Start and stop Zabbix server
15  # Description: Zabbix Server  # Description: Zabbix server
16  ### END INIT INFO  ### END INIT INFO
17    
18  # zabbix details  # Source function library.
19  if [ -x /usr/sbin/zabbix_server_mysql ]; then  . /etc/rc.d/init.d/functions
20      ZABBIX=zabbix_server_mysql  
21  elif [ -x /usr/sbin/zabbix_server_pgsql ]; then  if [ -x /usr/sbin/zabbix_server ]; then
22      ZABBIX=zabbix_server_pgsql      exec=/usr/sbin/zabbix_server
 elif [ -x /usr/sbin/zabbix_server_sqlite3 ]; then  
     ZABBIX=zabbix_server_sqlite3  
23  else  else
24      exit 5      exit 5
25  fi  fi
26    
27  CONF=/etc/zabbix/zabbix_server.conf  prog=${exec##*/}
28  PIDFILE=/var/run/zabbix.pid  conf=/etc/zabbix/zabbix_server.conf
29    pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
30  # Source function library.  timeout=10
 . /etc/rc.d/init.d/functions  
   
 # Source networking configuration.  
 . /etc/sysconfig/network  
31    
32  # Check that networking is up.  if [ -f /etc/sysconfig/zabbix-server ]; then
33  [ ${NETWORKING} = "no" ] && exit 0      . /etc/sysconfig/zabbix-server
34    fi
35    
36  [ -e $CONF ] || exit 6  lockfile=/var/lock/subsys/zabbix-server
37    
38  RETVAL=0  start()
39    {
40        echo -n $"Starting Zabbix server: "
41        daemon $exec -c $conf
42        rv=$?
43        echo
44        [ $rv -eq 0 ] && touch $lockfile
45        return $rv
46    }
47    
48    stop()
49    {
50        echo -n $"Shutting down Zabbix server: "
51        killproc -p $pidfile -d $timeout $prog
52        rv=$?
53        echo
54        [ $rv -eq 0 ] && rm -f $lockfile
55        return $rv
56    }
57    
58    restart()
59    {
60        stop
61        start
62    }
63    
64  case "$1" in  case "$1" in
65      start)      start|stop|restart)
66          echo -n "Starting zabbix server: "          $1
         daemon $ZABBIX -c $CONF  
         RETVAL=$?  
         echo  
         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix  
         ;;  
     stop)  
         echo -n "Shutting down zabbix server: "  
         killproc $ZABBIX  
         RETVAL=$?  
         echo  
         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix  
67          ;;          ;;
68      restart|reload)      force-reload)
69          $0 stop          restart
         $0 start  
         RETVAL=$?  
70          ;;          ;;
71      status)      status)
72          status $ZABBIX          status -p $pidfile $prog
73          RETVAL=$?          ;;
74        try-restart|condrestart)
75            if status $prog >/dev/null ; then
76                restart
77            fi
78            ;;
79        reload)
80            action $"Service ${0##*/} does not support the reload action: " /bin/false
81            exit 3
82          ;;          ;;
83      *)      *)
84          echo "Usage: $0 {start|stop|restart|reload|status}"          echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
85          exit 1          exit 2
86          ;;          ;;
87  esac  esac
88    
 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