I have a cron task set to run daily at 7am. The crontab file has a few perl scripts. I can always manually execute the perl script and it will run without a problem. But it seems like every few days (2-4) the cron task will fail. Oddly once the cron fails when I log into the server and change the time of the script to run later that day, it will successfully execute. But if I leave it at that new time, it will stop running a few days later. I have tried to run the cron task with both my user name & root and get the same result. Maybe it only runs successfully when my user name is logged into the server, otherwise there is no access to my user directory?
Current OS: Ubuntu 14.04.1 LTS
Perl: (v5.18.2)
crontab -e
0 7 * * 0-6 /usr/bin/perl /home/myuser/scripts/perl/flash.pl
0 7 * * 0-6 /usr/bin/perl /home/myuser/scripts/perl/flash2.pl
Cron email report (the previous day I had a successful script output):
Can't open perl script "/home/myuser/scripts/perl/flash.pl": No such f
+ile or directory"
...
Can't open perl script "/home/myuser/scripts/perl/flash2.pl": No such
+file or directory"
Manually running script:
:~/scripts/perl$ pwd
/home/myuser/scripts/perl
:~/scripts/perl$ ls -al
total 256
drwxrwxr-x 4 myuser myuser 4096 Oct 7 11:19 .
drwxrwxr-x 8 myuser myuser 4096 Aug 1 10:12 ..
-rwxr-xr-x 1 myuser myuser 5962 Jul 10 15:16 flash.pl
-rwxr-xr-x 1 myuser myuser 5534 Jul 10 15:19 flash2.pl
Manual execution:
:~/scripts/perl$ /usr/bin/perl /home/myuser/scripts/perl/flash.pl
running for: 2014-10-08
Number of rows affected: 8
Syslog w/cron which could not find directory:
Oct 9 07:00:01 CRON[5525]: (myuser) CMD (/usr/bin/perl /home/myuser/s
+cripts/perl/ALPT_mme_flash.pl)
Oct 9 07:00:01 CRON[5527]: (myuser) CMD (/usr/bin/perl /home/myuser/s
+cripts/perl/ALPT_volte_flash.pl)
Syslog w/cron which worked yesterday:
Oct 8 07:00:01 CRON[4556]: (myuser) CMD (/usr/bin/perl /home/myuser/s
+cripts/perl/flash.pl)
Oct 8 07:00:01 CRON[4559]: (myuser) CMD (/usr/bin/perl /home/myuser/s
+cripts/perl/flash2.pl)