Cron job not working


#1

Hi, I have a cron job setup like so…

0 2 * * * /home/USERNAME/scripts/delete.pl

but for whatever reason it is not running. I can confirm that the ‘delete.pl’ script works when I run…

perl /home/USERNAME/scripts/delete.pl

it does what I expect, so it doesn’t appear to be the script itself. Any thoughts? Is it a permissions issue?


#2

The permissions of the script needed to be changed.

chmod +x filename.pl


#3

It’s good you figured it out on your own. Note that running a script with ‘perl’ in front of it like you did will work fine except that it won’t point out problems with execute permission. If you run it as just ./myscript.pl that will tell you if it has the proper execution permissions set.

Also, it’s always good to put a MAILTO=‘me@mydomain.com’ line at the top of your cron entry so any errors will go somewhere you expect them to.

  • Dallas
  • DreamHost Head Honcho/Founder