LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-04-2007, 02:01 AM   #1
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Rep: Reputation: 15
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,
 
Old 01-04-2007, 06:20 AM   #2
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
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.
 
Old 01-04-2007, 07:56 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You can also check the system mail, which is the place where crontab jobs send their standard input and error by default.
 
Old 01-04-2007, 08:23 AM   #4
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Original Poster
Rep: Reputation: 15
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,
 
Old 01-04-2007, 08:53 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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! ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
backup with rsync muhammednavas Linux - Networking 4 12-01-2006 06:58 AM
rsync in crontab loonykroons Linux - Software 3 11-28-2006 03:08 AM
Using rsync to backup data. Best way to backup folders? Micro420 Linux - General 2 11-23-2006 01:13 AM
rsync as backup? ziggie216 Linux - Software 3 03-13-2005 02:22 PM
rsync backup... tarballed Linux - Networking 10 06-27-2003 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration