46 lines
878 B
Bash
Executable File
46 lines
878 B
Bash
Executable File
#! /bin/sh
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: monithor-d
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop:
|
|
# Short-Description: MoniThor Server
|
|
### END INIT INFO
|
|
|
|
set -e
|
|
|
|
test -x /usr/local/bin/monithor-server || exit 0
|
|
|
|
umask 022
|
|
|
|
|
|
case "$1" in
|
|
start)
|
|
if [ ! -z "$(ps axf| grep monithor-server | grep -v grep)" ]
|
|
then
|
|
logger "monithor-server is running ..."
|
|
exit
|
|
else
|
|
logger "Starting MoniThor Server"
|
|
/usr/local/bin/monithor-server start
|
|
fi
|
|
;;
|
|
stop)
|
|
logger "Stoping MoniThor server" "monithor-d" || true
|
|
/usr/local/bin/monithor-server stop
|
|
;;
|
|
|
|
status)
|
|
logger "status MoniThor server" "monithor-d" || true
|
|
[ "$(ps axf| grep '/usr/local/bin/monithor-server'|grep -v grep)" ] && echo "monithor-d is running" || echo "montihor-d is dead"
|
|
|
|
;;
|
|
|
|
|
|
*)
|
|
echo "Usage: /etc/init.d/monithor-d {start|stop|status}" || true
|
|
exit 1
|
|
esac
|
|
|
|
exit 0
|