monit: switch init script to procd
authorEtienne CHAMPETIER <etienne.champetier@free.fr>
Wed, 11 Jun 2014 20:52:07 +0000 (22:52 +0200)
committerEtienne CHAMPETIER <etienne.champetier@free.fr>
Wed, 11 Jun 2014 21:14:16 +0000 (23:14 +0200)
Successfully tested on ar71xx

Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr>
admin/monit/files/monit.init

index b8a8ff8240a852e53134705eb1f6cd02f0ea45d6..2bb360923aad0e70ec9d5bd5b882127ae539a2f3 100644 (file)
@@ -1,16 +1,15 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2013 OpenWrt.org
+# Copyright (C) 2014 OpenWrt.org
 
 START=60
+USE_PROCD=1
+PROG=/usr/bin/monit
 
-SERVICE_USE_PID=1
-
-start() {
-       [ -f /etc/monitrc ] || return 1
+start_service() {
+       [ -f /etc/monitrc ] || { echo "monit: /etc/monitrc is missing"; return 1; }
        chmod 0600 /etc/monitrc
-       service_start /usr/bin/monit
-}
-
-stop() {
-       service_stop /usr/bin/monit
+       procd_open_instance
+       # -I runs in foreground, as procd requires
+       procd_set_param command "$PROG" -I
+       procd_close_instance
 }