- ndo2db
#!/bin/bash
#
# ndo2db Start/Stop the ndo2db daemon for nagios SQL backend
#
# chkconfig: 2345 98 02
# description: connect ndo to the sql backend
# processname: ndo2db
# pidfile: /var/run/ndo2db.pid
# Source function library.
. /etc/init.d/functions
RETVAL=0
# See how we were called.
prog="ndo2db"
progdir="/usr/local/bin/"
# Source configuration
if [ -f /etc/sysconfig/$prog ] ; then
. /etc/sysconfig/$prog
fi
start() {
echo -n $"Starting $prog: "
daemon $progdir/$prog -c /etc/nagios/ndo2db.cfg
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ndo2db
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
# Would be better to send QUIT first, then killproc if that fails
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ndo2db
return $RETVAL
}
rhstatus() {
status ndo2db
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
rhstatus
;;
condrestart)
[ -f /var/lock/subsys/ndo2db ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}"
exit 1
esac
exit $?
Back to top