Multiple /usr/sbin/cron instances in 2.1
-
I use cron quite a bit and have had to write duplicate cron hunters into my scripts that are being launched because sometimes there will be 2 or 3 cron instances running and so the scripts will be launched multiple times simultaneously. My scripts don't work as well for some unknown reason in 2.1.
Has anyone had to deal with this problem?
-
I use cron quite a bit and have had to write duplicate cron hunters into my scripts that are being launched because sometimes there will be 2 or 3 cron instances running and so the scripts will be launched multiple times simultaneously. My scripts don't work as well for some unknown reason in 2.1.
Has anyone had to deal with this problem?
Interesting you bring it up…. I had the same problem. I modified the code that writes the cron.sh startup script (/usr/local/etc/rc.d) to do a "killall cron" in the stop logic. I can't remember where the is located (might have been one of the ".inc" files).
Anyway - that seems to have solved the problem.
-
I noticed something similar on one of my hosts, but it only appears to do it for dyndns checks:
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
…Also, as I had set up notifications via email, I was getting three emails each time as for some reason the dyndns updater is not working correctly (manually its fine...).
-
I noticed something similar on one of my hosts, but it only appears to do it for dyndns checks:
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
Oct 2 18:20:01 pfsense php: rc.dyndns.update: DynDns: updatedns() starting
…Also, as I had set up notifications via email, I was getting three emails each time as for some reason the dyndns updater is not working correctly (manually its fine...).
At least on my install, anything in the /etc/crontab file would execute once for each running cron process.
-
I have noticed it as well, it is a side effect of having the Cron package installed. Its startup script (cron.sh) wasn't very good about making sure it didn't start multiple times.
I checked in a fix, when you see the new version of cron show up, upgrade your package and it should behave better.
-
The latest cron package doesn't solve the problem. It has a syntax error in the kill line (needs a space before the ']').
BTW… after playing with it a little, I can confirm that the following stop line - placed in /usr/local/pkg/cron.inc - solves the problem...
"stop" => "[ -f '/var/run/cron.pid' ] && /bin/kill -9
cat /var/run/cron.pid
2>/dev/null; rm -f /var/run/cron.pid;" -
Not sure where you're seeing the bad spacing, in the file from the repo there is a space before the ]
Also the line you have isn't sufficient, it needs to kill all running copies of cron in addition to cleaning up the pid, as is done on the line there now.
I rm'd the cron.sh from my vm, reinstalled the pkg, and the syntax was correct/working.
-
Not sure where you're seeing the bad spacing, in the file from the repo there is a space before the ]
Also the line you have isn't sufficient, it needs to kill all running copies of cron in addition to cleaning up the pid, as is done on the line there now.
I rm'd the cron.sh from my vm, reinstalled the pkg, and the syntax was correct/working.
Your absolutely correct on it not being sufficient… just figured that out. Not sure why mine didn't have the space, but I'll assume it was a PIBKAC error :-)
-
I appreciate the fix. As of today, it doesn't appear there is a new version of cron available. Has it been released yet?
-
I appreciate the fix. As of today, it doesn't appear there is a new version of cron available. Has it been released yet?
It has been fixed since early October…
-
I appreciate the fix. As of today, it doesn't appear there is a new version of cron available. Has it been released yet?
It has been fixed since early October…
Cron package is at 0.1.8