Skip to content

Commit

Permalink
Create graphios.init.debian
Browse files Browse the repository at this point in the history
  • Loading branch information
gjedeer committed Jan 18, 2014
1 parent a84ccd9 commit f04fe1f
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions graphios.init.debian
@@ -0,0 +1,66 @@
#! /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

0 comments on commit f04fe1f

Please sign in to comment.