LinuxQuestions.org
Visit Jeremy's Blog.
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 10-18-2011, 03:59 PM   #1
wheel
Member
 
Registered: Sep 2003
Posts: 33

Rep: Reputation: 16
Rsync not excluding files


I backup my webserver using rsync, there's a few files I don't want to backup - but despite what *I* want, rsync is still backing them up.

here's my cron command (as root, this is located in /root, and called as /root/file.sh from cron):
rsync -e ssh -azv /home/userdir NN.NNN.NNN.NNN:/backup2/webserver --exclude-from exclude-list.txt --delete-excluded

Then in the file 'exclude-list.txt I have the following:
../home/userdir/websites/dir1
../home/userdir/websites/dir2
../home/userdir/websites/logs
../home/userdir/websites/dir3
../home/userdir/websites/dir4


Yet those directories are still backed up every night.

I feel like I may have a problem with my path, but changing to /home/...... doesn't change it - it still backs up the files.
 
Old 10-18-2011, 04:40 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Try using an absolute path to the exclude file as well

Last edited by kbp; 10-18-2011 at 04:41 PM.
 
Old 10-18-2011, 04:51 PM   #3
wheel
Member
 
Registered: Sep 2003
Posts: 33

Original Poster
Rep: Reputation: 16
Thanks! That was almost it, but not quite. I tried hardcoding the exclude file, no difference.

But when I ran the test, I noticed that the files it was backing up were listed as:
userdir/dir/file

instead of
/home/userdir/dir/file

And figured, perhaps the exclude files are relative to the files being rsynced (instead of relative to the current working dir). And sure enough, that worked.

In other words:
the original command was
rsynce /home/userdir

and to exclude /home/userdir/dir/, instead of using '/home/userdir/dir', I just used 'dir'. and that worked. Final exclude file looks like
websites/dir1
websites/dir2
etc.
And it worked!

Great, I've actually been stewing on this for years.
 
Old 10-18-2011, 05:03 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Glad you worked it out, I usually use Gnote so I don't forget all the little stumbling blocks I trip over
 
Old 10-18-2011, 09:05 PM   #5
rhbegin
Member
 
Registered: Oct 2003
Location: Arkansas, NWA
Distribution: Fedora/CentOS/SL6
Posts: 381

Rep: Reputation: 23
So did you use a file.txt with your excludes in it?

I normally do like this:

rsync -e "ssh -p 2222" -anP --exclude="_*" --exclude="*.xml" --exclude="*." --exclude=" --delete /opt/prod/dedmail/ sysadm01@ded02:/opt/prod/dedmail/


I use port 2222 going from server to server firewall rules block port 22.

However, I would like to know you do the text file with the excludes, I have another email server to migrate over and my rsync command is quite lengthy with all of my excludes and makes it quite cumbersome and easy to make a mistake.

Any help/advice would be greatly appreciated.

Last edited by rhbegin; 10-18-2011 at 09:11 PM.
 
  


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
rsync excluding hidden files? gonzojd7 Linux - Newbie 4 11-29-2018 09:02 AM
rsync excluding a single file/folder guna_pmk Linux - Software 1 04-05-2011 05:59 AM
rsync question - Excluding files with a certain character in the filename EmigrantChris Linux - General 2 04-21-2009 10:07 PM
excluding folders in a rsync command troubles cucolin@ Linux - Server 18 04-10-2007 10:59 AM
excluding files and 'mv' surfbass Linux - General 3 07-15-2006 07:59 PM

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

All times are GMT -5. The time now is 01:51 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