Getting started with cron

software development

#1

I followed the steps on this page to create a simple script that would write the time to a file. I am able to run the script manually just fine.

I then created a cronjob to test out this script:

50,1 * * * * /home/USER/scripts/cron-test.pl

I then added it to my crontab and it does not work. Rather than appending the time to the test file, I receive an email with this error in the body:

/bin/sh: /home/USER/scripts/cron-test.pl: Permission denied

(Where USER, of course, is my username.)

What am I doing wrong here?

Thanks,
Gabe


#2

I’m not sure, but this could be to do with the permissions on the Perl file in question? Have you tried CHMODing it to something else? Make sure that group and others are able to execute the script, not only you. If you have set permissions on the script so that only you can excecute it, this would explain why it works when you try and execute it yourself but not when cron tries to run it.

  • wil

#3

chmod +x /home/USER/scripts/cron-test.pl


#4

That did the trick! Thanks, Wil and Will!