From 059f97bf982435e7a34f908a9b524e44123095eb Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 7 Jan 2013 14:44:47 +0545 Subject: Improve cron rcfile stop processing If cron.pid did not exist, an error was emitted - that could happen when a stop is done at package install, before it was ever started. If cron is stopped, cron.pid was left behind. Another attempt to stop would emit an error about the pid in cron.pid no existing. This extra checking avoids any error messages if stop is called before start, or stop is called twice. --- config/cron/cron.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cron/cron.inc b/config/cron/cron.inc index e5df104a..88388b3c 100644 --- a/config/cron/cron.inc +++ b/config/cron/cron.inc @@ -82,7 +82,7 @@ function cron_install_command() write_rcfile(array( "file" => "cron.sh", "start" => "/usr/sbin/cron -s &", - "stop" => "kill -9 `cat /var/run/cron.pid`" + "stop" => "[ -f \"/var/run/cron.pid\" ] && kill -9 `cat /var/run/cron.pid`; rm -f /var/run/cron.pid;" ) ); -- cgit v1.2.3