0
0
Fork 0
mirror of https://github.com/alerta/alerta.git synced 2025-02-21 20:36:07 +00:00
alerta_alerta/contrib/experimental/ganglia/alert-ganglia.init

80 lines
1.2 KiB
Text
Raw Permalink Normal View History

2012-03-27 14:27:40 +00:00
#!/bin/bash
#
# alert-ganglia Start/stop the Alerter Ganglia daemon.
#
# chkconfig: 2345 90 60
# description: Alert Ganglia is the Ganglia alert feed server daemon for the alerting system.
# Source function library.
. /etc/init.d/functions
2013-03-22 15:27:30 +00:00
OPTIONS=""
2012-03-27 14:27:40 +00:00
RETVAL=0
2012-07-13 14:53:58 +00:00
prog="alert-ganglia"
2013-03-22 15:27:30 +00:00
binary=/usr/bin/$prog
2012-03-28 13:46:29 +00:00
pidfile=/var/run/alerta/$prog.pid
2012-03-27 14:27:40 +00:00
lockfile=/var/lock/subsys/$prog
# Source config
if [ -f /etc/sysconfig/$prog ] ; then
. /etc/sysconfig/$prog
fi
start() {
[ -x $binary ] || exit 5
2013-03-22 15:27:30 +00:00
# Check if it is already running
if prog_status > /dev/null; then
echo "$prog already running"
return 0
2013-03-22 15:27:30 +00:00
fi
echo -n "Starting $prog: "
daemon --pidfile=$pidfile $binary $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
2012-03-27 14:27:40 +00:00
return $RETVAL
}
stop() {
echo -n $"Shutting down $prog: "
2012-03-27 14:27:40 +00:00
killproc -p $pidfile $binary
RETVAL=$?
echo
2012-03-27 14:27:40 +00:00
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
prog_status() {
status -p $pidfile $prog
}
2012-03-27 14:27:40 +00:00
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
prog_status
;;
try-restart|condrestart)
if prog_status > /dev/null; then
stop
start
fi
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|try-restart|status}"
exit 2
;;
2012-03-27 14:27:40 +00:00
esac
exit $?