]> TLD Linux GIT Repositories - packages/zabbix.git/commitdiff
- added init scripts for proxy and server
authorMarcin Krol <hawk@tld-linux.org>
Mon, 4 Jan 2021 20:08:36 +0000 (21:08 +0100)
committerMarcin Krol <hawk@tld-linux.org>
Mon, 4 Jan 2021 20:08:36 +0000 (21:08 +0100)
zabbix.spec
zabbix_proxy.init [new file with mode: 0755]
zabbix_server.init [new file with mode: 0755]

index 57ef7b07cd20037a5b6305906806a380a38c280a..930f6efec3e9dcefadf56a64f544cf9da9099cb5 100644 (file)
@@ -22,6 +22,8 @@ Source0:      https://cdn.zabbix.com/zabbix/sources/stable/5.0/%{name}-%{version}.tar
 # Source0-md5: e0798bb1b53ab7b451556dc34c3b1827
 Source1:       %{name}-apache.conf
 Source2:       %{name}_agentd.init
+Source3:       %{name}_server.init
+Source4:       %{name}_proxy.init
 Patch0:                tld.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
@@ -332,6 +334,8 @@ cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
 
 install        %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
+install        %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
+install        %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
 
 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
@@ -473,6 +477,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
 %{_mandir}/man8/zabbix_proxy*
 %endif
@@ -501,6 +506,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_server
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
 %{_mandir}/man8/zabbix_server*
 %endif
diff --git a/zabbix_proxy.init b/zabbix_proxy.init
new file mode 100755 (executable)
index 0000000..71bef02
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Starts the zabbix_proxy daemon
+#
+# chkconfig:   345 95 5
+#
+# description: zabbix_proxy long service description
+#
+# processname: zabbix_proxy
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "Zabbix Proxy"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/zabbix_proxy ] && . /etc/sysconfig/zabbix_proxy
+
+pidfile="/var/run/zabbix/zabbix_proxy.pid"
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/zabbix_proxy ]; then
+               msg_already_running "Zabbix Proxy"
+               return
+       fi
+
+       msg_starting "Zabbix Proxy"
+       daemon /usr/sbin/zabbix_proxy
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_proxy
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/zabbix_proxy ]; then
+               msg_not_running "Zabbix Proxy"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "Zabbix Proxy"
+       killproc --pidfile $pidfile zabbix_proxy -TERM
+       rm -f /var/lock/subsys/zabbix_proxy
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/zabbix_proxy ]; then
+               msg_not_running "Zabbix Proxy"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status --pidfile $pidfile zabbix_proxy
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL
diff --git a/zabbix_server.init b/zabbix_server.init
new file mode 100755 (executable)
index 0000000..e98e121
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Starts the zabbix_server daemon
+#
+# chkconfig:   345 95 5
+#
+# description: zabbix_server long service description
+#
+# processname: zabbix_server
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+       if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+               msg_network_down "Zabbix Server"
+               exit 1
+       fi
+else
+       exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/zabbix_server ] && . /etc/sysconfig/zabbix_server
+
+pidfile="/var/run/zabbix/zabbix_server.pid"
+
+start() {
+       # Check if the service is already running?
+       if [ -f /var/lock/subsys/zabbix_server ]; then
+               msg_already_running "Zabbix Server"
+               return
+       fi
+
+       msg_starting "Zabbix Server"
+       daemon /usr/sbin/zabbix_server
+       RETVAL=$?
+       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/zabbix_server
+}
+
+stop() {
+       if [ ! -f /var/lock/subsys/zabbix_server ]; then
+               msg_not_running "Zabbix Server"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "Zabbix Server"
+       killproc --pidfile $pidfile zabbix_server -TERM
+       rm -f /var/lock/subsys/zabbix_server
+}
+
+condrestart() {
+       if [ ! -f /var/lock/subsys/zabbix_server ]; then
+               msg_not_running "Zabbix Server"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
+       ;;
+  restart)
+       stop
+       start
+       ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
+  status)
+       status --pidfile $pidfile zabbix_server
+       RETVAL=$?
+       ;;
+  *)
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+       exit 3
+esac
+
+exit $RETVAL