File nagiosgrapher.init of Package nagiosgrapher
#! /bin/sh
# Copyright (c) 2019 SUSE Software Solutions Germany GmbH, Nuremberg
#
# /etc/init.d/nagiosgrapher
# and its symbolic link
# /usr/sbin/nagiosgrapher
#
### BEGIN INIT INFO
# Provides: nagiosgrapher
# Required-Start: $local_fs $syslog
# Should-Start: nagios
# Required-Stop: $local_fs $syslog
# Should-Stop: nagios
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: NagiosGrapher daemon
# Description: Start the NagiosGrapher daemon
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
nagiosgrapher_BIN=/usr/lib/nagios/plugins/contrib/collect2.pl
test -x $nagiosgrapher_BIN || { echo "$nagiosgrapher_BIN not installed"; exit 5; }
# Check for existence of needed config file
nagiosgrapher_CONFIG=/etc/nagios/ngraph.ncfg
test -r $nagiosgrapher_CONFIG || { echo "$nagiosgrapher_CONFIG not existing"; exit 6; }
# Source LSB init functions
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting nagiosgrapher "
test -d /var/run/nagiosgrapher || mkdir -p /var/run/nagiosgrapher
startproc $nagiosgrapher_BIN
rc_status -v
;;
stop)
echo -n "Shutting down nagiosgrapher "
killproc -TERM $nagiosgrapher_BIN
rc_status -v
;;
try-restart|condrestart)
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
echo -n "Reload service nagiosgrapher "
/sbin/killproc -HUP $nagiosgrapher_BIN
rc_status -v
;;
status)
echo -n "Checking for service nagiosgrapher "
checkproc $nagiosgrapher_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart}"
exit 1
;;
esac
rc_exit