Commit 994e9fa7 authored by Alvaro G. M's avatar Alvaro G. M Committed by Thomas Petazzoni
Browse files

dcron: provide init script



dcron doesn't create a pid file, so we run it in foreground but make
start-stop-daemon create the pidfile and move the daemon to background.

Give it a number greater than exim's init script, so job output email
can be sent.

[Thomas: as suggested by Yann E. Morin, use DCRON_INSTALL_INIT_SYSV.]

Signed-off-by: default avatarAlvaro G. M <alvaro.gamez@hazent.com>
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
parent 00bf6360
Loading
Loading
Loading
Loading

package/dcron/S90dcron

0 → 100644
+22 −0
Original line number Diff line number Diff line
#!/bin/sh

case "$1" in
	start)
		echo -n "Starting cron ... "
		start-stop-daemon -S -q -m -b -p /var/run/dcron.pid --exec /usr/sbin/crond -- -f
		echo "done."
		;;
	stop)
		echo -n "Stopping cron ..."
		start-stop-daemon -K -q -p /var/run/dcron.pid
		echo "done."
		;;
	restart)
		$0 stop
		sleep 1
		$0 start
		;;
	*)
		echo "usage: $0 {start|stop|restart}"
		;;
esac
+4 −0
Original line number Diff line number Diff line
@@ -29,4 +29,8 @@ define DCRON_INSTALL_TARGET_CMDS
	        $(TARGET_DIR)/etc/cron.monthly $(TARGET_DIR)/etc/cron.weekly
endef

define DCRON_INSTALL_INIT_SYSV
	$(INSTALL) -D -m 0755 package/dcron/S90dcron $(TARGET_DIR)/etc/init.d/S90dcron
endef

$(eval $(generic-package))