[packages/monit] unify initscript
glen
glen at pld-linux.org
Mon Oct 27 16:19:58 CET 2014
commit d2e1d75a0a3daf09e671abced034e48662021c57
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Mon Oct 27 17:18:20 2014 +0200
unify initscript
monit.init | 58 ++++++++++++++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 26 deletions(-)
---
diff --git a/monit.init b/monit.init
old mode 100644
new mode 100755
index f213155..1792def
--- a/monit.init
+++ b/monit.init
@@ -24,29 +24,45 @@ checkconfig() {
start() {
# Check if the service is already running?
- if [ ! -f /var/lock/subsys/monit ]; then
- checkconfig
- msg_starting monit
- daemon --pidfile /var/run/monit.pid /usr/sbin/monit -c /etc/monitrc -s /var/run/monit.state $OPTIONS
- RETVAL=$?
- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monit
- else
+ if [ -f /var/lock/subsys/monit ]; then
msg_already_running monit
+ return
fi
+
+ checkconfig
+ msg_starting monit
+ daemon --pidfile /var/run/monit.pid /usr/sbin/monit -c /etc/monitrc -s /var/run/monit.state $OPTIONS
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monit
}
stop() {
# Stop daemons.
- if [ -f /var/lock/subsys/monit ]; then
- msg_stopping monit
- busy
- /usr/sbin/monit -c /etc/monitrc quit
- RETVAL=$?
- [ $RETVAL -eq 0 ] && ok || fail
- rm -f /var/lock/subsys/monit > /dev/null 2>&1
- else
+ if [ ! -f /var/lock/subsys/monit ]; then
msg_not_running monit
+ return
fi
+
+ msg_stopping monit
+ busy
+ /usr/sbin/monit -c /etc/monitrc quit
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && ok || fail
+ rm -f /var/lock/subsys/monit > /dev/null 2>&1
+}
+
+reload() {
+ if [ ! -f /var/lock/subsys/monit ]; then
+ msg_not_running monit
+ exit 7
+ fi
+
+ checkconfig
+ msg_reloading monit
+ busy
+ /usr/sbin/monit -c /etc/monitrc reload
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && ok || fail
}
RETVAL=0
@@ -64,17 +80,7 @@ case "$1" in
start
;;
reload|force-reload)
- if [ -f /var/lock/subsys/monit ]; then
- checkconfig
- msg_reloading monit
- busy
- /usr/sbin/monit -c /etc/monitrc reload
- RETVAL=$?
- [ $RETVAL -eq 0 ] && ok || fail
- else
- msg_not_running monit
- exit 7
- fi
+ reload
;;
checkconfig)
checkconfig
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/monit.git/commitdiff/d2e1d75a0a3daf09e671abced034e48662021c57
More information about the pld-cvs-commit
mailing list