1

Cron jobs seem to be running as I see this in my /var/log/cron

Nov 5 09:00:01 glumbo CROND[18740]: (root) CMD (cd /var/www/domain.com/cgi-bin;./cron.pl >/root/cron.log 2>&1) 

However, no output is saved to /root/cron.log

When I run the same command (cd /var/www/domain.com/cgi-bin;./cron.pl >/root/cron.log 2>&1) at the command line I get output saved to /root/cron.log

What is happening?

2
  • cron has d different environment from your shell, have you double checked that you are setting PATH, and stuff in your script? Commented Nov 5, 2011 at 7:45
  • Did you try running your script with the full path instead of doing a cd and the issuing ./cron.pl? Commented Nov 5, 2011 at 15:51

2 Answers 2

3

My first guess would be that when the job is run in cron, it's not being run as root somehow, and thus can't write to /root/cron.log. Check that and check the permissions on /root/cron.log.

Also, exactly what does 'cron.pl' do? Anything useful in /var/log/messages?

Try replacing the call to cron.pl with a simple 'echo' statement, then see if that is ending up in /root/cron.log.

1
  • It says root in the line I pasted in the question. cron.log is set to 666. Cron.pl checks a database to delete entries and then prints the number of entries deleted. Nothing in var/log/messages Commented Nov 5, 2011 at 6:46
2

I've never liked stacking commands in cron -- it's almost always cleaner to have a wrapper script, and call that from cron.

I'm guessing that it's failing for some reason, and it's generating output which is being sent to mail, and either the mail's misconfigured and not being delivered, load's too high and mail delivery is suspended, root's mail is being forwarded elsewhere, or you haven't looked through root's mailbox.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.