Skip to content

Instantly share code, notes, and snippets.

@WimObiwan
Last active March 2, 2017 09:51
Show Gist options
  • Save WimObiwan/72104c1db74e7b97cc0e59f89b6b280d to your computer and use it in GitHub Desktop.
Save WimObiwan/72104c1db74e7b97cc0e59f89b6b280d to your computer and use it in GitHub Desktop.
Zabbix_agent init.d script Centos 7
#!/bin/sh
#
# zabbix_agentd start/stop script for CentOS 7
#
# * Save as /etc/rc.d/init.d/zabbix_agent
# * Run /sbin/chkconfig --add zabbix_agent
# * Start with service start zabbix_agent
#
# Source function library.
. /etc/rc.d/init.d/functions
# Path to zabbix_agentd and its base path.
#progdir="/usr/local/bin/"
progdir="/usr/sbin/"
prog="zabbix_agentd"
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $progdir$prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/zabbix/$prog.pid
}
reload() {
echo -n $"Reloading $prog: "
killproc $prog -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/zabbix/$prog.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
*)
echo $"Usage: $prog {start|stop|status|restart|condrestart|reload}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment