ndo2db init script (redhat style)

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 $?

nagios/ndo2db_init_script.txt · Last modified: 2010-02-05 16:28 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0