debugging cronjobs not running

Jeremy Chadwick koitsu at FreeBSD.org
Sun Nov 9 04:36:41 PST 2008


On Sun, Nov 09, 2008 at 06:57:10AM -0500, Michael P. Soulier wrote:
> So, I'm running cron in debug mode, and I do see things like this
> about my crontab.

I'm not sure why you sent this to me directly, but I do appreciate you
CC'ing the mailing lists.  :-)

> load_entry()...returning successfully
> load_env, read <*/5 * * * * cacti /usr/local/bin/php
> /usr/local/share/cacti/poller.php 1>/dev/null 2>&1>
> load_env, parse error, state = 7
> 
> but that parse_error line is the same for many links that do seem to
> be run properly.

I have no familiarity with the internals of cron, so I have no idea what
"parse error" implies, nor "state = 7".

> The symptoms I'm seeing is some cronjobs, specifically weekly ones,
> not running as expected. Plus, I used to get email from the nightly
> runs of periodic, and now I don't see anything. I know some jobs
> aren't running because they produce files as output and I'm not seeing
> them. That, or they're simply running unsuccessfully.
>
> One thing I noticed is that "man 5 crontab" seems to make no mention
> of the "user" field used in /etc/crontab, but that's likely just a
> documentation error.

That's because /etc/crontab is not crontab(5).  See cron(8) for mentions
of the "system-level crontab".  Please file a PR on the documentation
confusion so it can get fixed/addressed.

> Has anyone ever configured cronjobs that just didn't run, or you
> didn't get mail for them like you should have?

No, this has never happened to me, or on any of the systems I've
administrated.

It might be worthwhile using "crontab -e -u <user>" and see if those
crontabs reliably work for you.  If so, then the problem is likely with
the system-level crontab and not with user-level crontabs.

Before doing this, be sure to note what security/pam checks get applied
to user-level crontabs vs. system-level crontabs.  This is documented in
cron(8).  You might have to change shells of some accounts on your
system to get user-level crontabs to work for those accounts.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |



More information about the freebsd-questions mailing list