aboutsummaryrefslogtreecommitdiff
path: root/system/monit/rc.monit
diff options
context:
space:
mode:
authorRicardson Williams <ricardsonwilliams@yahoo.com.br>2010-05-11 20:02:02 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-11 20:02:02 +0200
commit4fd7a6d9d4346a0ea09895a4fd991b4f68541825 (patch)
tree63ce181959c17b75bd3fd4c9e1cc3030e959ed91 /system/monit/rc.monit
parent9e4c1ae9755ae816f7badc26734aeda0ae48c658 (diff)
system/monit: Added to 12.0 repository
Diffstat (limited to 'system/monit/rc.monit')
-rw-r--r--system/monit/rc.monit76
1 files changed, 76 insertions, 0 deletions
diff --git a/system/monit/rc.monit b/system/monit/rc.monit
new file mode 100644
index 0000000000000..f1bd5107f823e
--- /dev/null
+++ b/system/monit/rc.monit
@@ -0,0 +1,76 @@
+#!/bin/bash
+#
+# Init file for Monit process monitor.
+#
+# Written by Dag Wieers <dag@wieers.com>.
+# Adapted for Slackware by Eric Hameleers <alien@slackware.com>
+#
+
+### Default variables
+CONFIG="/etc/monit.conf"
+PIDFILE="/var/run/monit.pid"
+
+[ -x /usr/bin/monit ] || exit 1
+[ -r "$CONFIG" ] || exit 1
+
+RETVAL=0
+prog="monit"
+desc="Process Monitor"
+
+start() {
+ echo "Starting $desc ($prog): /etc/rc.d/rc.$prog start"
+ $prog -c $CONFIG -p $PIDFILE
+ return $?
+}
+
+stop() {
+ echo "Shutting down $desc ($prog)..."
+ if [ -f $PIDFILE ]; then
+ kill -TERM $(cat $PIDFILE)
+ else
+ killall -TERM $prog
+ fi
+ return $?
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ echo "Reloading $desc ($prog)"
+ $prog -c $CONFIG reload
+ return $?
+}
+
+status() {
+ PIDS=$(pidof $prog)
+ if [ "$PIDS" == "" ]; then
+ echo "$prog is not running!"
+ else
+ echo "$prog is running at pid(s) ${PIDS}."
+ fi
+ return $?
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ status)
+ status
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|status}"
+esac
+