LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Backup with rsync and crontab (http://www.linuxquestions.org/questions/linux-general-1/backup-with-rsync-and-crontab-516132/)

gjblackford 01-04-2007 03:01 AM

Backup with rsync and crontab
 
Hi,

I have written a simple backup script which runs fine through the console (with su), but when I try to set it up as a cron job, it doesnt run.

the backup script is as follows
Code:

rsync -a --delete /home/gavinjb/ /mnt/IntBackup/Gavin/
rsync -a --delete /srv/www/ /mnt/IntBackup/www

and the crontab is as follows
Code:

20 * * * * root /home/gavinjb/Documents/scripts/backup.sh
I am trying to get the job to run every hour, can anyone see what I have done wrong.

the cron job is created under su and not standard user.

Thanks,

Gavin,

frob23 01-04-2007 07:20 AM

You probably need to add the complete path to rsync in the script. Since it may not be in the path when cron runs.

I'm assuming you have #!/bin/sh at the top and it is executable.

colucix 01-04-2007 08:56 AM

You can also check the system mail, which is the place where crontab jobs send their standard input and error by default.

gjblackford 01-04-2007 09:23 AM

Hi,

Can you tell me how I access the system mail, I am fairly new to Linux and havent got as far as looking at system mail yet :).

Thanks,

colucix 01-04-2007 09:53 AM

You have to be logged in as the user that launched the crontab, and type 'mail' on the command line. You get a list of the messages you have in your mailbox (if any). Type "?" to retrieve a list of commands, type the number of the message you want to read, type "x" to exit. And of course read the manual page of mail to learn more! ;-)


All times are GMT -5. The time now is 10:56 PM.