6
2
I have created a script called "forward_email.sh" and set permissions to 777. It contains the following line:
echo "It worked: $(date)" >> /home/noc/email.log
I created a cron job with the following line:
*/5 * * * * /home/noc/forward_email.sh
The problem is that the "email.log" file never gets changed. I even set the permissions to 666. When I run the script manually, it works perfectly.
The cron job is running according to the "/var/log/cron.log" file.
Can someone point me into the right direction as to what might be going wrong? This is a minimal virtual machine install of Ubuntu Server 9.04 with cron installed via apt-get.
UPDATE: I made a very stupid mistake. I named my script "forward_mail.sh". I wasn't until I installed some email services and got the following error email from Cron that I discover my mistake.
/bin/sh: /home/noc/forward_email.sh: not found
I changed the name of the file, and it works now.
isn't this more like.. serverfault question? – codingbear – 2009-08-04T04:04:24.720
2Users use cron. – Richard Hoskins – 2009-08-04T04:08:05.413
can you provide output of crontab -l ? – John T – 2009-08-04T04:09:40.497
crontab -l outputs the same line in the original question. – Joseph – 2009-08-04T04:17:13.320
2Does /etc/cron.allow exist? – Richard Hoskins – 2009-08-04T04:38:28.037
Yes, and the only thing contained in it is "noc". – Joseph – 2009-08-04T04:57:13.660
What are the permissions of /etc/cron.allow? Does cron.deny exist? – Richard Hoskins – 2009-08-04T05:05:48.910
-rw-r--r-- 1 root root 10 2009-08-04 01:01 cron.allow
cron.deny does not exist. – Joseph – 2009-08-04T05:06:59.127
@Joseph: Fool of a took! ;-) – Pete – 2009-08-04T16:33:29.233