But openbsd-inetd dep in the correct package
[invirt/packages/invirt-remote.git] / debian / invirt-remote-host.init
index d3c3849..1de5697 100755 (executable)
@@ -20,17 +20,35 @@ gen_config()
     done
 }
 
-case "$1" in
-  start|reload|force-reload|restart)
+reload_cfg()
+{
     log_begin_msg "Reloading config for $PACKAGE"
     gen_config
     log_end_msg $?
     invoke-rc.d openbsd-inetd start # returns 1 if inetd is running
-    [ $? -eq 1 ] && exit 0
+}
+
+case "$1" in
+  start)
+    reload_cfg
+
+    log_begin_msg "Starting the invirt-janitor for $PACKAGE"
+    daemon -n invirt-janitor -r invirt-janitor
+    log_end_msg $?
+    ;;
+  force-reload|restart)
+    reload_cfg
+
+    log_begin_msg "Restarting the invirt-janitor for $PACKAGE"
+    daemon -n invirt-janitor --restart
+    log_end_msg $?
     ;;
   stop)
+    log_begin_msg "Stopping the invirt-janitor for $PACKAGE"
+    daemon -n invirt-janitor --stop
+    log_end_msg $?
     ;;
   *)
-    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
+    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|force-reload|restart|stop}"
     ;;
 esac