I have the following 3 commands which are supposed to run every night to back up my web server: rsync -avve ssh --numeric-ids --delete --ignore-errors myuser at myisp.com:/usr/home/myuser /Volumes/Downloads rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors myuser at myisp.com:/usr/home/myuser/mail_boxes /Volumes/Downloads/myuser/mail_boxesBU rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors myuser at myisp.com:/usr/home/myuser/mail_boxes /Volumes/Downloads/myuser/mail_boxesBU The way this works is that there are two symlinks on the server to the mail_boxes and public_html directories. I didn?t want all the symlinks within those directories to be followed, so these I backup separately to mail_boxesBU and public_htmlBU respectively. Unfortunately, when the first command is run, both are deleted from the local volume, and then must be completely downloaded from scratch each night after the deletion, instead of simply being updated. This doesn?t always work for some reason, and the next morning one or both of the directories are just gone. Is there some way of excluding the mail_boxesBU and public_htmlBU directories from --delete? Thanks. Jeffrey -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20091003/2a80db5b/attachment.html>
On Sat, 2009-10-03 at 15:47 -0700, J. Ellis wrote:> I have the following 3 commands which are supposed to run every night > to back up my web server: > > rsync -avve ssh --numeric-ids --delete --ignore-errors > myuser at myisp.com:/usr/home/myuser /Volumes/Downloads > rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors > myuser at myisp.com:/usr/home/myuser/mail_boxes /Volumes/Downloads/myuser/mail_boxesBU > rsync -avve ssh --copy-links --numeric-ids --delete --ignore-errors > myuser at myisp.com:/usr/home/myuser/mail_boxes /Volumes/Downloads/myuser/mail_boxesBU > > The way this works is that there are two symlinks on the server to the > mail_boxes and public_html directories. I didn?t want all the symlinks > within those directories to be followed, so these I backup separately > to mail_boxesBU and public_htmlBU respectively.There happens to be a trick for "copying a few dirlinks" without copying all of them: use --relative and specify an additional source argument that goes through each symlink with a trailing slash. E.g.: rsync -avve ssh --numeric-ids --delete --ignore-errors -R \ myuser at isp.com:/usr/home/./myuser \ myuser at isp.com:/usr/home/./myuser/mail_boxes/ \ myuser at isp.com:/usr/home/./myuser/public_html/ \ /Volumes/Downloads For more about this, see: http://lists.samba.org/archive/rsync/2006-February/014838.html> Unfortunately, when the first command is run, both are deleted from > the local volume, and then must be completely downloaded from scratch > each night after the deletion, instead of simply being updated. This > doesn?t always work for some reason, and the next morning one or both > of the directories are just gone. > > Is there some way of excluding the mail_boxesBU and public_htmlBU > directories from --delete?If you want to keep your existing approach, yes, you can just use --exclude='/myuser/mail_boxesBU' and --exclude='/myuser/public_htmlBU'. -- Matt
On Sat, 2009-10-03 at 22:06 -0700, Jeffrey Ellis wrote:> Hm. I've tried all of the following: > > rsync -avve ssh --numeric-ids --delete --ignore-errors -R > myuser at myisp.com:/usr/home/./myuser > myuser at myisp.com:/usr/home/./myuser/mail_boxes/ > myuser at myisp.com:/usr/home/./myuser/public_html/ /Volumes/Downloads > > (no returns, only spaces here. Line breaks here are actually a single > space). > > rsync -avve ssh --numeric-ids --delete --ignore-errors -R > \myuser at myisp.com:/usr/home/./myuser > \myuser at myisp.com:/usr/home/./myuser/mail_boxes/ > \myuser at myisp.com:/usr/home/./myuser/public_html/ \/Volumes/Downloads > > (again, no returns. Line breaks here are a single space, followed by a \). > > rsync -avve ssh --numeric-ids --delete --ignore-errors -R \ > myuser at myisp.com:/usr/home/./myuser \ > myuser at myisp.com:/usr/home/./myuser/mail_boxes/ \ > myuser at myisp.com:/usr/home/./myuser/public_html/ \ /Volumes/Downloads > > (no returns. Line breaks are a single space, followed by a \, then another > single space). > > rsync -avve ssh --numeric-ids --delete --ignore-errors -R \ > myuser at myisp.com:/usr/home/./myuser \ > myuser at myisp.com:/usr/home/./myuser/mail_boxes/ \ > myuser at myisp.com:/usr/home/./myuser/public_html/ \ > /Volumes/Downloads > > (These are a space followed by a \ followed by a return. I'd actually prefer > the single line). > > I'm definitely in the bash shell. > > These all come up with errors, so I must be doing something wrong.Your first and last attempts should have worked. What error do you get? -- Matt