0

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?

4
  • Are you editing /etc/crontab directly via an editor or using crontab -e? You should be using crontab -e.
    – pacey
    Commented Dec 3, 2010 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
    Commented Dec 3, 2010 at 13:39
  • actually your correct, can you post it as an answer and i will mark it as correct for you.
    – Rob Dando
    Commented Dec 3, 2010 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). Commented Dec 3, 2010 at 16:33

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .