LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File zabbix.patch of Package Zabbix (Project home:mwilderoth:test)

diff -Naur zabbix-1.1beta9/misc/init.d/suse/10.0/zabbix_agentd zabbix-1.1beta9.suse/misc/init.d/suse/10.0/zabbix_agentd
--- zabbix-1.1beta9/misc/init.d/suse/10.0/zabbix_agentd	1970-01-01 01:00:00.000000000 +0100
+++ zabbix-1.1beta9.suse/misc/init.d/suse/10.0/zabbix_agentd	2006-05-19 13:02:30.000000000 +0200
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (c) 2006 Linserv AB, Sweden
+#
+# Author: Martin Wilderoth <martin@linserv.se>
+#
+# /etc/init.d/zabbix_agentd
+#
+### BEGIN INIT INFO
+# Provides:       zabbix_agentd
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop:
+# Default-Start:  3 5 
+# Default-Stop:
+# Description:    Starts Zabbix_Agentd
+### END INIT INFO
+
+# Check for missing binaries (stale symlinks should not happen)
+# Note: Special treatment of stop for LSB conformance
+ZABBIX_BIN=/home/zabbix/bin/zabbix_agentd
+test -x $ZABBIX_BIN || { echo "$ZABBIX_BIN not installed";
+        if [ "$1" = "stop" ]; then exit 0;
+        else exit 5; fi; }
+
+zabbix_conf=/etc/zabbix/zabbix_agentd.conf
+
+PidFile=`grep PidFile= $zabbix_conf | awk -F = '{print $2'}`
+LogFile=`grep LogFile= $zabbix_conf | awk -F = '{print $2'}`
+
+# Shell functions sourced from /etc/rc.status:
+. /etc/rc.status
+
+# Reset status of this service
+rc_reset
+
+case "$1" in
+    start)
+        # Remove pidfile if zabbix is  not running.
+        /sbin/checkproc -p $PidFile $ZABBIX_BIN
+        if [ $? = 0 ]; then
+            echo -n "Zabbix Agent daemon is already running"
+            rc_status -v
+            rc_exit
+        elif [ -e $PidFile ]; then
+            rm -f $PidFile&> /dev/null
+        fi;
+
+        echo -n "Starting Zabbix Agent daemon"
+
+        # Test to see if logfile exists, create if missing.
+        if ! [ -f $LogFile ]; then
+            echo
+            echo -n "Creating the zabbix log file"
+            /bin/touch $LogFile
+            /bin/chown zabbix: $LogFile
+        fi
+
+        $ZABBIX_BIN
+	rc_status -v
+	;;
+    stop)
+	echo -n "Shutting down $ZABBIX_BIN "
+	/sbin/killproc -p $PidFile -TERM $ZABBIX_BIN
+	rc_status -v
+	;;
+    restart)
+	$0 stop
+        sleep 60
+	$0 start
+	rc_status
+	;;
+    status)
+        echo -n "Checking for service zabbix_agentd "
+        /sbin/checkproc -p $PidFile $ZABBIX_BIN
+        rc_status -v
+        ;;
+        *)
+	echo "Usage: $0 {start|stop|status|restart}"
+	exit 1
+	;;
+esac
+rc_exit
+
diff -Naur zabbix-1.1beta9/misc/init.d/suse/10.0/zabbix_server zabbix-1.1beta9.suse/misc/init.d/suse/10.0/zabbix_server
--- zabbix-1.1beta9/misc/init.d/suse/10.0/zabbix_server	1970-01-01 01:00:00.000000000 +0100
+++ zabbix-1.1beta9.suse/misc/init.d/suse/10.0/zabbix_server	2006-05-19 12:45:39.000000000 +0200
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (c) 2006 Linserv AB, Sweden
+#
+# Author: Martin Wilderoth <martin@linserv.se>
+#
+# /etc/init.d/zabbix_server
+#
+### BEGIN INIT INFO
+# Provides:       zabbix_server
+# Required-Start: $network $remote_fs $syslog 
+# Should-Start:   mysql postgresql
+# Required-Stop:
+# Default-Start:  3 5 
+# Default-Stop:
+# Description:    Starts Zabbix_Server
+### END INIT INFO
+
+# Check for missing binaries (stale symlinks should not happen)
+# Note: Special treatment of stop for LSB conformance
+ZABBIX_BIN=/home/zabbix/bin/zabbix_server
+test -x $ZABBIX_BIN || { echo "$ZABBIX_BIN not installed";
+        if [ "$1" = "stop" ]; then exit 0;
+        else exit 5; fi; }
+
+zabbix_conf=/etc/zabbix/zabbix_server.conf
+
+PidFile=`grep PidFile $zabbix_conf | awk -F = '{print $2'}`
+LogFile=`grep LogFile $zabbix_conf | awk -F = '{print $2'}`
+
+# Shell functions sourced from /etc/rc.status:
+. /etc/rc.status
+
+# Reset status of this service
+rc_reset
+
+case "$1" in
+    start)
+        # Remove pidfile if zabbix is  not running.
+        /sbin/checkproc -p $PidFile $ZABBIX_BIN
+        if [ $? = 0 ]; then
+            echo -n "Zabbix Server is already running"
+            rc_status -v
+            rc_exit
+        elif [ -e $PidFile ]; then
+            echo 
+            echo
+            echo "#############################################################"
+            echo "#                                                           #"
+            echo "# Zabbix server ended abnormally. The database is probably  #"
+            echo "# corrupt. Please run mysqlcheck --auto-repair zabbix and   #"
+            echo "# manually remove the pidfile.                              #"
+            echo "#                                                           #"
+            echo "# Try to restart the service after this process             #"
+            echo "#                                                           #"
+            echo "#############################################################"
+            echo 
+            echo
+            echo "pidfile = $PidFile"
+            echo 
+            echo
+#            rm -f $PidFile&> /dev/null
+        fi;
+
+        echo -n "Starting Zabbix Server"
+
+        # Test to see if logfile exists, create if missing.
+        if ! [ -f $LogFile ]; then
+            echo
+            echo -n "Creating the zabbix log file"
+            /bin/touch $LogFile
+            /bin/chown zabbix: $LogFile
+        fi
+
+        $ZABBIX_BIN
+	rc_status -v
+	;;
+    stop)
+	echo -n "Shutting down Zabbix Server "
+        /sbin/killproc -p $PidFile -TERM $ZABBIX_BIN
+        rc_status -v
+	;;
+    restart)
+	$0 stop
+	$0 start
+	rc_status
+	;;
+    status)
+        echo -n "Checking for service Zabbix Server "
+        /sbin/checkproc -p $PidFile $ZABBIX_BIN
+        rc_status -v
+        ;;
+        *)
+	echo "Usage: $0 {start|stop|status|restart}"
+	exit 1
+	;;
+esac
+rc_exit
+