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)

In reply to Crontab "Can't open perl script", " No such file or directory" by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.