rpms/zabbix/F-11 zabbix-agent.init, 1.3, 1.4 zabbix-proxy.init, 1.1, 1.2 zabbix-server.init, 1.4, 1.5 zabbix.spec, 1.37, 1.38

Dan Horák sharkcz at fedoraproject.org
Mon May 18 12:10:59 UTC 2009


Author: sharkcz

Update of /cvs/pkgs/rpms/zabbix/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv11031

Modified Files:
	zabbix-agent.init zabbix-proxy.init zabbix-server.init 
	zabbix.spec 
Log Message:
* Fri Apr 17 2009 Ville Skyttä <ville.skytta at iki.fi> - 1.6.4-3
- Tighten configuration file permissions.
- Ensure zero exit status from scriptlets.
- Improve init script LSB compliance.
- Restart running services on package upgrades.



Index: zabbix-agent.init
===================================================================
RCS file: /cvs/pkgs/rpms/zabbix/F-11/zabbix-agent.init,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- zabbix-agent.init	7 Jul 2008 08:03:13 -0000	1.3
+++ zabbix-agent.init	18 May 2009 12:10:28 -0000	1.4
@@ -1,7 +1,9 @@
-#! /bin/sh
+#!/bin/sh
 #
 # chkconfig: - 85 15
-# description: zabbix agent daemon
+# description: ZABBIX agent daemon
+# processname: zabbix_agentd
+# config: /etc/zabbix/zabbix_agentd.conf
 #
 
 ### BEGIN INIT INFO
@@ -10,58 +12,65 @@
 # Required-Stop: $local_fs $network
 # Default-Start:
 # Default-Stop: 0 1 2 3 4 5 6
-# Short-Description: start and stop zabbix agent
-# Description: Zabbix Agent
+# Short-Description: Start and stop ZABBIX agent
+# Description: ZABBIX agent
 ### END INIT INFO
 
-# zabbix details
-ZABBIX_AGENTD=/usr/sbin/zabbix_agentd
-CONF=/etc/zabbix/zabbix_agentd.conf
-PIDFILE=/var/run/zabbix-agent.pid
-
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-# Source networking configuration.
-. /etc/sysconfig/network
-
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
-[ -x $ZABBIX_AGENTD ] || exit 5
-[ -e $CONF ] || exit 6
-
-RETVAL=0
+exec=/usr/sbin/zabbix_agentd
+prog=${exec##*/}
+lockfile=/var/lock/subsys/zabbix-agent
+
+start()
+{
+    echo -n $"Starting ZABBIX agent: "
+    daemon $exec
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && touch $lockfile
+    return $rv
+}
+
+stop()
+{
+    echo -n $"Shutting down ZABBIX agent: "
+    killproc $prog
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && rm -f $lockfile
+    return $rv
+}
+
+restart()
+{
+    stop
+    start
+}
 
 case "$1" in
-    start)
-        echo -n "Starting zabbix agent: "
-        daemon $ZABBIX_AGENTD -c $CONF
-        RETVAL=$?
-        echo
-        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix-agent
+    start|stop|restart)
+        $1
         ;;
-    stop)
-        echo -n "Shutting down zabbix agent: "
-        killproc zabbix_agentd
-        RETVAL=$?
-        echo
-        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix-agent
-        ;;
-    restart|reload)
-        $0 stop
-        $0 start
-        RETVAL=$?
+    force-reload)
+        restart
         ;;
     status)
-        status zabbix_agentd
-        RETVAL=$?
+        status $prog
+        ;;
+    try-restart|condrestart)
+        if status $prog >/dev/null ; then
+            restart
+        fi
+        ;;
+    reload)
+        action $"Service ${0##*/} does not support the reload action: " /bin/false
+        exit 3
         ;;
     *)
-	echo "Usage: $0 {start|stop|restart|reload|status}"
-	exit 1
+	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+	exit 2
 	;;
 esac
 
-exit $RETVAL
-


Index: zabbix-proxy.init
===================================================================
RCS file: /cvs/pkgs/rpms/zabbix/F-11/zabbix-proxy.init,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- zabbix-proxy.init	30 Sep 2008 17:41:33 -0000	1.1
+++ zabbix-proxy.init	18 May 2009 12:10:28 -0000	1.2
@@ -1,75 +1,84 @@
-#! /bin/sh
+#!/bin/sh
 #
 # chkconfig: - 85 15
-# description: zabbix proxy daemon
+# description: ZABBIX proxy daemon
+# config: /etc/zabbix/zabbix_proxy.conf
 #
 
 ### BEGIN INIT INFO
-# Provides: zabbix
+# Provides: zabbix-proxy
 # Required-Start: $local_fs $network
 # Required-Stop: $local_fs $network
 # Default-Start:
 # Default-Stop: 0 1 2 3 4 5 6
-# Short-Description: start and stop zabbix proxy
-# Description: Zabbix Proxy
+# Short-Description: Start and stop ZABBIX proxy
+# Description: ZABBIX proxy
 ### END INIT INFO
 
-# zabbix details
+# Source function library.
+. /etc/rc.d/init.d/functions
+
 if [ -x /usr/sbin/zabbix_proxy_mysql ]; then
-    ZABBIX_PROXY=zabbix_proxy_mysql
+    exec=zabbix_proxy_mysql
 elif [ -x /usr/sbin/zabbix_proxy_pgsql ]; then
-    ZABBIX_PROXY=zabbix_proxy_pgsql
+    exec=zabbix_proxy_pgsql
 elif [ -x /usr/sbin/zabbix_proxy_sqlite3 ]; then
-    ZABBIX_PROXY=zabbix_proxy_sqlite3
+    exec=zabbix_proxy_sqlite3
 else
     exit 5
 fi
-
-CONF=/etc/zabbix/zabbix_proxy.conf
-PIDFILE=/var/run/zabbix.pid
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Source networking configuration.
-. /etc/sysconfig/network
-
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
-[ -e $CONF ] || exit 6
-
-RETVAL=0
+prog=${exec##*/}
+lockfile=/var/lock/subsys/zabbix-proxy
+conf=
+
+start()
+{
+    echo -n $"Starting ZABBIX proxy: "
+    daemon $exec
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && touch $lockfile
+    return $rv
+}
+
+stop()
+{
+    echo -n $"Shutting down ZABBIX proxy: "
+    killproc $prog
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && rm -f $lockfile
+    return $rv
+}
+
+restart()
+{
+    stop
+    start
+}
 
 case "$1" in
-    start)
-        echo -n "Starting Zabbix proxy: "
-        daemon $ZABBIX_PROXY -c $CONF
-        RETVAL=$?
-        echo
-        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix-proxy
-        ;;
-    stop)
-        echo -n "Shutting down Zabbix proxy: "
-        killproc $ZABBIX_PROXY
-        RETVAL=$?
-        echo
-        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/zabbix-proxy
+    start|stop|restart)
+        $1
         ;;
-    restart|reload)
-        $0 stop
-        $0 start
-        RETVAL=$?
+    force-reload)
+        restart
         ;;
     status)
-        status $ZABBIX_PROXY
-        RETVAL=$?
+        status $prog
+        ;;
+    try-restart|condrestart)
+        if status $prog >/dev/null ; then
+            restart
+        fi
+        ;;
+    reload)
+        action $"Service ${0##*/} does not support the reload action: " /bin/false
+        exit 3
         ;;
     *)
-	echo "Usage: $0 {start|stop|restart|reload|status}"
-	exit 1
+	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+	exit 2
 	;;
 esac
 
-exit $RETVAL
-


Index: zabbix-server.init
===================================================================
RCS file: /cvs/pkgs/rpms/zabbix/F-11/zabbix-server.init,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- zabbix-server.init	30 Sep 2008 17:36:49 -0000	1.4
+++ zabbix-server.init	18 May 2009 12:10:28 -0000	1.5
@@ -1,7 +1,8 @@
-#! /bin/sh
+#!/bin/sh
 #
 # chkconfig: - 85 15
-# description: zabbix server daemon
+# description: ZABBIX server daemon
+# config: /etc/zabbix/zabbix_server.conf
 #
 
 ### BEGIN INIT INFO
@@ -10,66 +11,73 @@
 # Required-Stop: $local_fs $network
 # Default-Start:
 # Default-Stop: 0 1 2 3 4 5 6
-# Short-Description: start and stop zabbix server
-# Description: Zabbix Server
+# Short-Description: Start and stop ZABBIX server
+# Description: ZABBIX server
 ### END INIT INFO
 
-# zabbix details
+# Source function library.
+. /etc/rc.d/init.d/functions
+
 if [ -x /usr/sbin/zabbix_server_mysql ]; then
-    ZABBIX=zabbix_server_mysql
+    exec=zabbix_server_mysql
 elif [ -x /usr/sbin/zabbix_server_pgsql ]; then
-    ZABBIX=zabbix_server_pgsql
+    exec=zabbix_server_pgsql
 elif [ -x /usr/sbin/zabbix_server_sqlite3 ]; then
-    ZABBIX=zabbix_server_sqlite3
+    exec=zabbix_server_sqlite3
 else
     exit 5
 fi
+prog=${exec##*/}
+lockfile=/var/lock/subsys/zabbix
 
-CONF=/etc/zabbix/zabbix_server.conf
-PIDFILE=/var/run/zabbix.pid
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-# Source networking configuration.
-. /etc/sysconfig/network
-
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
-[ -e $CONF ] || exit 6
-
-RETVAL=0
+start()
+{
+    echo -n $"Starting ZABBIX server: "
+    daemon $exec
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && touch $lockfile
+    return $rv
+}
+
+stop()
+{
+    echo -n $"Shutting down ZABBIX server: "
+    killproc $prog
+    rv=$?
+    echo
+    [ $rv -eq 0 ] && rm -f $lockfile
+    return $rv
+}
+
+restart()
+{
+    stop
+    start
+}
 
 case "$1" in
-    start)
-        echo -n "Starting zabbix server: "
-        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
+    start|stop|restart)
+        $1
         ;;
-    restart|reload)
-        $0 stop
-        $0 start
-        RETVAL=$?
+    force-reload)
+        restart
         ;;
     status)
-        status $ZABBIX
-        RETVAL=$?
+        status $prog
+        ;;
+    try-restart|condrestart)
+        if status $prog >/dev/null ; then
+            restart
+        fi
+        ;;
+    reload)
+        action $"Service ${0##*/} does not support the reload action: " /bin/false
+        exit 3
         ;;
     *)
-	echo "Usage: $0 {start|stop|restart|reload|status}"
-	exit 1
+	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
+	exit 2
 	;;
 esac
 
-exit $RETVAL
-


Index: zabbix.spec
===================================================================
RCS file: /cvs/pkgs/rpms/zabbix/F-11/zabbix.spec,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -p -r1.37 -r1.38
--- zabbix.spec	9 Apr 2009 14:42:13 -0000	1.37
+++ zabbix.spec	18 May 2009 12:10:28 -0000	1.38
@@ -1,6 +1,6 @@
 Name:           zabbix
 Version:        1.6.4
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Open-source monitoring solution for your IT infrastructure
 
 Group:          Applications/Internet
@@ -380,33 +380,69 @@ getent passwd zabbix > /dev/null || \
 
 %post server
 /sbin/chkconfig --add zabbix-server
+if [ $1 -gt 1 ]
+then
+  # Apply permissions also in *.rpmnew upgrades from old permissive ones
+  chmod 0640 %{_sysconfdir}/zabbix/zabbix_server.conf
+  chown root:zabbix %{_sysconfdir}/zabbix/zabbix_server.conf
+fi
+:
 
 %post agent
-/sbin/chkconfig --add zabbix-agent
+/sbin/chkconfig --add zabbix-agent || :
 
 %post proxy
 /sbin/chkconfig --add zabbix-proxy
+if [ $1 -gt 1 ]
+then
+  # Apply permissions also in *.rpmnew upgrades from old permissive ones
+  chmod 0640 %{_sysconfdir}/zabbix/zabbix_proxy.conf
+  chown root:zabbix %{_sysconfdir}/zabbix/zabbix_proxy.conf
+fi
+:
 
 %preun server
 if [ "$1" = 0 ]
 then
-  /sbin/service zabbix-server stop >/dev/null 2>&1 || :
+  /sbin/service zabbix-server stop >/dev/null 2>&1
   /sbin/chkconfig --del zabbix-server
 fi
+:
 
 %preun agent
 if [ "$1" = 0 ]
 then
-  /sbin/service zabbix-agent stop >/dev/null 2>&1 || :
+  /sbin/service zabbix-agent stop >/dev/null 2>&1
   /sbin/chkconfig --del zabbix-agent
 fi
+:
 
 %preun proxy
 if [ "$1" = 0 ]
 then
-  /sbin/service zabbix-proxy stop >/dev/null 2>&1 || :
+  /sbin/service zabbix-proxy stop >/dev/null 2>&1
   /sbin/chkconfig --del zabbix-proxy
 fi
+:
+
+%postun server
+if [ $1 -ge 1 ]
+then
+  /sbin/service zabbix-server try-restart >/dev/null 2>&1 || :
+fi
+
+%postun proxy
+if [ $1 -ge 1 ]
+then
+  /sbin/service zabbix-proxy try-restart >/dev/null 2>&1 || :
+fi
+
+%postun agent
+if [ $1 -ge 1 ]
+then
+  /sbin/service zabbix-agent try-restart >/dev/null 2>&1 || :
+fi
+
 
 %post web
 # move existing config file on update
@@ -418,6 +454,7 @@ then
         chown apache:apache %{_sysconfdir}/zabbix/web/zabbix.conf.php
     fi
 fi
+:
 
 
 %files
@@ -433,7 +470,7 @@ fi
 
 %files server
 %defattr(-,root,root,-)
-%config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
+%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-server
 %{_sysconfdir}/init.d/zabbix-server
 
@@ -465,7 +502,7 @@ fi
 
 %files proxy
 %defattr(-,root,root,-)
-%config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
+%attr(0640,root,zabbix) %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix-proxy
 %{_sysconfdir}/init.d/zabbix-proxy
 
@@ -483,7 +520,7 @@ fi
 
 %files web
 %defattr(-,root,root,-)
-%dir %attr(0755,apache,apache) %{_sysconfdir}/zabbix/web
+%dir %attr(0750,apache,apache) %{_sysconfdir}/zabbix/web
 %ghost %attr(0644,apache,apache) %config(noreplace) %{_sysconfdir}/zabbix/web/zabbix.conf.php
 %config(noreplace) %{_sysconfdir}/httpd/conf.d/zabbix.conf
 %{_datadir}/zabbix
@@ -499,6 +536,12 @@ fi
 
 
 %changelog
+* Fri Apr 17 2009 Ville Skyttä <ville.skytta at iki.fi> - 1.6.4-3
+- Tighten configuration file permissions.
+- Ensure zero exit status from scriptlets.
+- Improve init script LSB compliance.
+- Restart running services on package upgrades.
+
 * Thu Apr  9 2009 Dan Horák <dan[at]danny.cz> - 1.6.4-2
 - make the -docs subpackage noarch
 




More information about the fedora-extras-commits mailing list