Getting a cron job to work :S

Associate
Joined
19 Jun 2003
Posts
1,680
Location
West Yorks, UK
Hi all,
I have written a shell script that backs up websites on our dedicated Fedora Core 3 server. I can call it through SSH with "sh /path to/script.sh" and it works great. I have added an entry at the bottom of Crontab thus:
Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
0 2 * * * root /scripts/websitebackup.sh

But it doesn't run. I have restarted cron (I think!). Am I missing something from the above? I wondered if I need to put:
Code:
0 2 * * * root sh /scripts/websitebackup.sh

Any ideas?

Cheers,
Matt
 
Thanks guys. I've added the correct entry into Crontab and restarted the service. Hopefully, ill get an email tomorrow morning saying the backup has been carried out.

Cheers,
Matt
 
Change the time to the next 5 minutes and get a reply earlier ;)

BTW, I don't know if editing crontab itself is the best way. You may want to use

crontab -e

to edit but beware that you may have to use vi comannds :o
 
Last edited:
Back
Top Bottom