Skip to content

Instantly share code, notes, and snippets.

@gjedeer
Created January 17, 2014 20:14
Show Gist options
  • Save gjedeer/8480601 to your computer and use it in GitHub Desktop.
Save gjedeer/8480601 to your computer and use it in GitHub Desktop.
Graphios sysvinit file for debian
#! /bin/bash
### BEGIN INIT INFO
# Provides: graphios
# Required-Start: $local_fs $remote_fs $syslog $named $network $time nagios3
# Required-Stop: $local_fs $remote_fs $syslog $named $network
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: graphios bridge between nagios and graphite
# Description: graphios feeds nagios performance data to graphite
### END INIT INFO
# File : graphios
# Source function library.
. /lib/lsb/init-functions
prog="/opt/graphios/graphios.py"
# or use the command line options:
#prog="/opt/nagios/bin/graphios.py --log-file=/dir/mylog.log --spool-directory=/dir/my/sool"
GRAPHIOS_USER="nagios"
RETVAL=0
start () {
log_daemon_msg "Starting $DESC" "$NAME"
/usr/bin/sudo -u $GRAPHIOS_USER "$prog" &
log_end_msg $?
echo
}
stop () {
log_daemon_msg "Stopping $DESC" "$NAME"
killproc graphios.py
log_end_msg $?
echo
}
restart () {
stop
start
}
# See how we are called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
status)
status $prog
RETVAL=$?
;;
*)
echo "Usage: service graphios {start|stop|restart|reload}"
RETVAL=2
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment