Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.