File: //etc/rc0.d/K50ncpa
#!/bin/bash
### BEGIN INIT INFO
# Provides: ncpa
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This manages the NCPA service
# Description: NCPA is a cross platform monitoring agent for Nagios that requires no dependencies.
### END INIT INFO
# init.d / servicectl compatibility (openSUSE)
if [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
fi
# Source function library
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
BASEDIR="/usr/local/ncpa"
# Start NCPA service
start() {
if [ -n "$(type -t action)" ] && [ "$(type -t action)" = function ]; then
action "Starting NCPA:" $BASEDIR/ncpa --start
else
echo -e "Started NCPA"
$BASEDIR/ncpa --start
fi
}
# Stop NCPA service
stop() {
if [ -n "$(type -t action)" ] && [ "$(type -t action)" = function ]; then
action "Stopping NCPA:" $BASEDIR/ncpa --stop
else
echo -e "Stopped NCPA"
$BASEDIR/ncpa --stop
fi
}
# Main init script logic
case "$1" in
start)
start
;;
stop)
stop
;;
status)
$BASEDIR/ncpa --status
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0