I'm having problems with setting my crontab script to run. When I execute it manually it works. My crontab file looks like this:

17 13           1-31 * 1-7              /myscripts/svn_backup_script.sh

Could anyone tell me if there are any more nessesary steps needed for it to work?

migrated from stackoverflow.com Sep 22 '12 at 22:23

This question came from our site for professional and enthusiast programmers.


check if your script is executable, if not, set it

chmod u+x /myscripts/svn_backup_script.sh

you can also redirect your script output to a file to check if it shows any errors

17 13 1-31 * 1-7    /myscripts/svn_backup_script.sh &> /tmp/svn_backup_script.log

I guess your cron daemon is running

/etc/init.d/cron start

Try not having ".sh" on the end of the script name, ISTR run-parts doesn't like it

  • This does matter for things using run-parts(8). It would be a problem if it were just a script being left in /etc/cron.daily for instance, but in this case it is fine. Regular crontab entries have nothing to do with run-parts – stew Sep 23 '12 at 12:09
  • thanks stew, i thought that might be the case, but "worth a try" ;) – Tom Newton Sep 23 '12 at 12:12

I think you should take a look on your environment variables, PATH and SHELL. You can define another default shell in this way. When I used crontab an OCSInventory script to run, it helped me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.