aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@world.inf.org>2013-01-07 14:44:47 +0545
committerPhil Davis <phil.davis@world.inf.org>2013-01-07 14:44:47 +0545
commit059f97bf982435e7a34f908a9b524e44123095eb (patch)
tree54911dcf9845b84c2230a4bfef7ecfe13f1619c5
parentff8b5325d6c7c97364a6d549871a815445497b70 (diff)
downloadpfsense-packages-059f97bf982435e7a34f908a9b524e44123095eb.tar.gz
pfsense-packages-059f97bf982435e7a34f908a9b524e44123095eb.tar.bz2
pfsense-packages-059f97bf982435e7a34f908a9b524e44123095eb.zip
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.
-rw-r--r--config/cron/cron.inc2
1 files changed, 1 insertions, 1 deletions
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;"
)
);