in reply to Perl cron job not running

date >> /tmp/mycron.log; /usr/bin/perl /share/script/Test/report.pl

Change the semicolon to && since cron executes only one command per entry:

*/5 * * * * date >> /tmp/mycron.log && /usr/bin/perl /share/script/Tes +t/report.pl

update: wrong test - as haukex writes below, cron takes the rest of the line as one command.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Perl cron job not running
by haukex (Archbishop) on Jul 20, 2016 at 08:47 UTC

    Hi shmem,

    I guess there are different implementations of cron and it depends on that? The one on my system doesn't care about semicolons and executes multiple commands.

    Regards,
    -- Hauke D

      whipped up a cron line

      */1 * * * * root touch /tmp/foo; touch bar

      and checked /tmp - meh... bar was touched in /root of course :-P

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

        Hi shmem,

        Yeah, I've been using cron more often recently and I've been bitten by stuff like that :-)

        BTW, I noticed that there is a special character that cron does care about: apparently % marks the start of data that will be sent to the command on STDIN (and is converted to a newline after that). I'll have to try and remember that one too...

        Regards,
        -- Hauke D