aboutsummaryrefslogtreecommitdiffstats
path: root/config/cron
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-10-03 10:00:10 -0400
committerjim-p <jimp@pfsense.org>2013-10-03 10:00:51 -0400
commit82e52b528fbd6ab11965f9a4f87982d3a67b5633 (patch)
treeed411cd5e7f9299e2c0c63f41f2fd6c9d4efd809 /config/cron
parent31e1e189d5600b363842263bbfe5f38cff7fa66c (diff)
downloadpfsense-packages-82e52b528fbd6ab11965f9a4f87982d3a67b5633.tar.gz
pfsense-packages-82e52b528fbd6ab11965f9a4f87982d3a67b5633.tar.bz2
pfsense-packages-82e52b528fbd6ab11965f9a4f87982d3a67b5633.zip
Avoid starting cron multiple times, and make sure to stop all running cron processes and not just the one we have a PID for.
Diffstat (limited to 'config/cron')
-rw-r--r--config/cron/cron.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/config/cron/cron.inc b/config/cron/cron.inc
index 88388b3c..2fe9cf57 100644
--- a/config/cron/cron.inc
+++ b/config/cron/cron.inc
@@ -81,8 +81,8 @@ function cron_install_command()
write_rcfile(array(
"file" => "cron.sh",
- "start" => "/usr/sbin/cron -s &",
- "stop" => "[ -f \"/var/run/cron.pid\" ] && kill -9 `cat /var/run/cron.pid`; rm -f /var/run/cron.pid;"
+ "start" => "[ `/bin/pgrep -f 'cron -s' | wc -l` -eq 0 ] && /usr/sbin/cron -s &",
+ "stop" => "[ -f \"/var/run/cron.pid\" ] && kill -9 `cat /var/run/cron.pid`; rm -f /var/run/cron.pid; /bin/pkill -f 'cron -s'"
)
);