0
0
Fork 0
mirror of https://github.com/alerta/alerta.git synced 2025-01-26 02:08:31 +00:00
alerta_alerta/contrib/ganglia/ganglia-api.init
2013-03-01 20:47:59 +00:00

69 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
#
# ganglia-api Start/stop the Ganglia Metric API
#
# chkconfig: 2345 80 70
# description: Ganglia metric API for the Ganglia cluster and host metric data
# Source function library.
. /etc/init.d/functions
RETVAL=0
prog="ganglia-api"
binary=/opt/ganglia/ganglia-api.py
pidfile=/var/run/$prog.pid
lockfile=/var/lock/subsys/$prog
# Source config
if [ -f /etc/sysconfig/$prog ] ; then
. /etc/sysconfig/$prog
fi
start() {
[ -x $binary ] || exit 5
# Start daemons.
echo -n $"Starting $prog: "
daemon "$binary $OPTIONS >/dev/null 2>&1 &"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
echo -n $"Shutting down $prog: "
killproc -p $pidfile $binary
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog > /dev/null; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|status}"
exit 2
esac
exit $?