LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-01-2010, 05:36 AM   #1
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Rep: Reputation: 38
Problems with rsync and backups


I'm having problems doing backups with rsync.
Using Debian Lenny

When I use the following script rsync deletes directories in
/mnt/backup: debian and home and syncs the /home directory with
/mnt/backup. I want to do incremental backups in
/mnt/backup/debian/home. this is the script I'm using:

Quote:
#!/bin/bash
mount /mnt/backup
cd /mnt/backup/debian/home/
rm -rf backup.7
mv backup.6 backup.7
mv backup.5 backup.6
mv backup.4 backup.5
mv backup.3 backup.4
mv backup.2 backup.3
mv backup.1 backup.2
mv backup.0 backup.1
cd /
rsync -av --delete --exclude-from='/root/scripts/exclude-files' --delete-excluded \
--link-dest=/mnt/backup/debian/home/backup.1 \
/home/ /mnt/backup/debian/home/backup.0/ \
umount /mnt/backup
when I use this script with the -n option rsync renames the file:
It renames backup.0 to backup.1. Isn't the -n option
supposed to be a dry run; why is it changing things?

Thanks
 
Old 02-01-2010, 07:41 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
The '-n' dry run option is an rsync option, not an option for the whole script. The script ignores all options (and doesn't pass them on to rsync). Not only that, but it is the mv commands in the script that move the directories, not the rsync part of it.

Last edited by neonsignal; 02-01-2010 at 07:42 AM.
 
Old 02-01-2010, 07:46 PM   #3
JosephS
Member
 
Registered: Jun 2007
Distribution: Debian Jessie, Bunsenlabs
Posts: 586

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by neonsignal View Post
The '-n' dry run option is an rsync option, not an option for the whole script. The script ignores all options (and doesn't pass them on to rsync). Not only that, but it is the mv commands in the script that move the directories, not the rsync part of it.
Thanks I realize that now. I must have been half asleep. I also
figured out the problem with the script for backup.
I should have left off the \ from the end of this line:
Quote:
/home/ /mnt/backup/debian/home/backup.0/ \
now it works.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using rsync for incremental backups cccc Linux - Server 5 01-29-2010 06:02 AM
rsync - Backups pkraus109 Linux - Server 2 05-21-2009 12:36 PM
Rsync backups gabsik Linux - General 3 11-24-2006 07:14 PM
Rsync backups gabsik Linux - Networking 1 03-30-2006 10:31 AM
rsync and cp -al for staggered backups babyphil Linux - Software 2 06-14-2005 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:41 PM.

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