I have created a script and can execute it from command line with no issues works perfectly. I have now tried to set it up as a 15 minute recurring cron job and it seems to run something as the file is created in the correct place however it is empty.

this is my cron job line

 */2 * * * * root /root/cron.database-backup.sh

and I am editing /etc/crontab

Any suggestions?

link|improve this question
Are you editing /etc/crontab directly via an editor or using crontab -e? You should be using crontab -e. – pacey Dec 3 '10 at 13:36
i have been using nano /etc/crontab, it seems that the script is getting run but for some reason the script is not working fully while the same script works fine run directly from the command line – Rob Dando Dec 3 '10 at 13:39
actually your correct, can you post it as an answer and i will mark it as correct for you. – Rob Dando Dec 3 '10 at 13:42
1  
You have to say @pacey to make sure to get the attention of the user you're talking to unless the comment is attached to their question or answer (like this one is to yours). – Dennis Williamson Dec 3 '10 at 16:33
feedback

1 Answer

up vote 0 down vote accepted

There is a file that cron uses that lists all the cron jobs.

You shouldn't edit this file directly, but you should use the crontab command to edit it.

So:

crontab [-u user] -l        ### will list the current cron jobs
crontab [-u user] -e        ### will drop you into an editor to edit the jobs

the -u user part is optional, and should only be used if you want to edit the crontab file for a user you are not logged in as.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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