Link to home
Start Free TrialLog in
Avatar of dougp23
dougp23Flag for United States of America

asked on

Rsync Backup Help

I have a linux server.  I want to back it up to an external USB Drive.  I am thinking rsync is the way to go.

I want to backup everything under

/var/opt/scalix/

WITH THE EXCEPTION OF

/var/opt/scalix/ql/archive/

Also, it looks like I need to script this since sometimes I can't write to the drive (it will say it's ready only.  Unmounting and remounting seems to fix it).

Assume my drive is /media/USBDrive

How would you do this?  I'm esp rusty with the cron part!
ASKER CERTIFIED SOLUTION
Avatar of jjmcd
jjmcd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dougp23

ASKER

Cool.  I assume the --delete flag says "if you have a file on the backup but it's no longer here on the server, then delete it from the backup"?

I am using CentOS, and the exclude uses an = sign, so it's

--exclude=/var/opt/scalix/ql/archive

Thanks!  
just my two cents... On Ubuntu I use:
rsync --verbose --progress --stats --recursive --times --perms --links --delete --exclude '.gvfs' /home/brian/ /wd500/

With the delete command it does just what you wrote; if the file is deleted from /home/brian it will be removed from /wd500.  If there is a file on /wd500 and not on /home/brian it will be removed from /wd500.
1- Anotehr useful option would be --stats this gives you a summery statistics to what has been copied.

2- For a script it good to have the output especially the stats part logged to a file or sent to an email.
Avatar of jjmcd
jjmcd

In fact, if you allow the output to go to stdout, you can add a line like

MAILTO=root@localhost

to your crontab, and any job AFTER that line in the crontab will have its output mailed to root.  Although sometimes I find it handy to direct output to a log file, depending on the job.

When you are first getting something going, I agree with small_student that you often want some validation as to what went on.  But once a job is well tested, I like for it to output nothing, unless it breaks.  Then I only get an email when something goes wrong.