summaryrefslogtreecommitdiffstats
path: root/zabbix-agent/zabbix-agentd
diff options
context:
space:
mode:
Diffstat (limited to 'zabbix-agent/zabbix-agentd')
-rw-r--r--zabbix-agent/zabbix-agentd53
1 files changed, 53 insertions, 0 deletions
diff --git a/zabbix-agent/zabbix-agentd b/zabbix-agent/zabbix-agentd
new file mode 100644
index 0000000..dc31c8e
--- /dev/null
+++ b/zabbix-agent/zabbix-agentd
@@ -0,0 +1,53 @@
+#!/bin/bash
+#
+# Source function library.
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# Check that networking is up.
+if ck_daemon network; then
+ echo "Cannot run zabbix-agent without network - run network first"
+ exit
+fi
+
+
+start () {
+ stat_busy "Starting zabbix-agent"
+ /usr/sbin/zabbix_agentd &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon zabbix_agentd
+ stat_done
+ fi
+ }
+
+stop() {
+ stat_busy "Stopping zabbix-agent"
+ killall zabbix_agentd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon zabbix_agentd
+ stat_done
+ fi
+ }
+
+# See how we were called.
+case $1 in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo $"Usage: zabbix-agent {start|stop|restart}"
+ exit 1
+ esac
+
+exit $RETVAL