File: //etc/rc4.d/S99superq
#!/bin/bash
# chkconfig: 345 99 1
#
# /etc/rc.d/init.d/superq
#
# Freezes process trees and queues them based on definition patterns.
#
# description: Freezes process trees and queues them based on definition patterns. \
# This is a sledgehammer solution for unpredictable launching processes \
# which should not be used if there is a more proper method.
# processname: superq.py
# Source function library.
. /etc/init.d/functions
superq_file='/opt/hgmods/automated_monitoring/superq'
start() {
echo -n "Starting superq: "
daemon "$superq_file"
echo
return $?
}
reload() {
echo -n "Reloading superq: "
if pkill -USR1 -o superq &>/dev/null;then
success
else
failure
fi
echo
return $?
}
stop() {
echo -n "Shutting down superq: "
killproc "$superq_file"
echo
return $?
}
status() {
if ps x|grep -q "${superq_file}$"; then
echo "superq is running."
return 0
else
echo "superq is not running."
return 1
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
stop
start
;;
reload)
reload
;;
condrestart)
echo "Unsupported."
;;
probe)
echo "Unsupported."
;;
*)
echo "Usage: <servicename> {start|stop|status|restart"
exit 1
;;
esac
exit