Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've made a script that backs some files up and puts them in a folder,

When I do

sudo /data/backups/scripts/

It works, I just want to make it a cron job so that it runs every night

I have this line in /etc/crontab

30 23 * * * /bin/bash /data/backups/scripts/

The script leaves a log file, indicating when it was called, and I can see that the cron never calls this script, am I doing something wrong?

This is a centos machine, here is the output of uname -a

Linux venus 2.6.32-279.1.1.el6.x86_64 #1 SMP Tue Jul 10 13:47:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
share|improve this question
There should be no need to call bash. Try adding #!/bin/bash in the first line of your file instead. Check the cron log for more information and enable e-mailing the execution output to you if you want. – zmode Oct 17 '12 at 17:30
up vote 3 down vote accepted

When adding entries to /etc/crontab you must include a username.

So something like

30 23 * * * root /bin/bash /data/backups/scripts/

Past that you need to examine your scripts use of environment variables. Cron has a very limited environment/PATH/etc. Some of the variables you have set in your interactive shell probably won't be set the same when the script is run from cron.

share|improve this answer
It worked, many thanks – user893730 Oct 26 '12 at 14:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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