in reply to The "Perl script on command line works but as cronjob it fails" story revisited

When you say "It is impossible to test on prod," do you mean that you aren't able to use an interactive shell on prod to run the perl script on a command line (i.e. prod can only run your perl script via cron)? You didn't mention trying to run your script at the command line on the production machine.

Given the evidence provided, I would expect that there might be something like a carriage-return character at the end of the shebang line in the copy of the script that sits on prod. (Have you checked byte-counts and/or md5 checksums for the two copies of the script? Does the test copy happen to have CRLF line terminations?)

If there was that sort of difference between the test and prod copies of the script, it would explain why using /usr/bin/perl as the command executed in the shell script would get it to work via cron.

  • Comment on Re: The "Perl script on command line works but as cronjob it fails" story revisited

Replies are listed 'Best First'.
Re^2: The "Perl script on command line works but as cronjob it fails" story revisited
by karlgoethebier (Abbot) on Mar 06, 2013 at 12:51 UTC

    Hi graff!

    "Does the test copy happen to have CRLF line terminations?"

    No it doesn't. If so, it won't run on Linux.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»