Debugging cron tasks

Being a *nix noob, I found it really hard to figure out the problem I had with a cron job last week.

The fact that sendmail was disabled in the machine I was working on also didn’t help (no emails were sent during failed cron task execution).

To workaround the problem, I found a useful tip from this post which enables console logging for cron.

add this line to /etc/syslog.conf

cron.debug /dev/console

I then got an error from the redirect logs which said:

sudo: sorry, you must have a tty to run sudo

This was easily fixed by commenting out the line below from /etc/sudoers (a tip from another blog post):

#Default requiretty

Hope this helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: