rsync --include-from syntax
I'm putting together a backup scenario using rsync.
I'm setting it up so I can have cron run a shell script containing an rsync command every night against a list of servers in a separate file and using an include from list in another separate file.
Almost working...
My current issue is that my include-from file currently looks like this:
+ etc/***
+ home/***
+ var/www/***
+ var/spool/mail/***
+ var/lib/mysql/***
+ opt/IBM/***
+ root/***
- *
When the script runs it does not indicate any error, but only syncs etc, home, and root. Anything with a path deeper than one folder is ignored.
I'm sure my syntax must be wrong. Any thoughts?
Responses
You may post the cron command for further help. Just a quick guess, is the recursive option set? I'm sure you would have set it, please post cron job command so that any of the community members would help you....
As per the man page of 'rsync'...
If a pattern excludes a particular parent directory, it can render a deeper include pattern ineffectual because rsync did not descend through that excluded section of the hierarchy. This is particularly important when using a trailing ’*’ rule. For instance, this won’t work:
+ /some/path/this-file-will-not-be-found
+ /file-is-included
- *
This fails because the parent directory "some" is excluded by the ’*’ rule, so rsync never visits any of the files in the "some" or "some/path" directories. One solution is to ask for all directories in the hierarchy to be included by using a single rule: "+ */" (put it somewhere before the "- *" rule), and perhaps use the --prune-empty-dirs option. Another solution is to add specific include rules for all the parent dirs that need to be visited. For instance, this set of rules works fine:
+ /some/
+ /some/path/
+ /some/path/this-file-is-found
+ /file-also-included
- *
You may have to re-define your include file list. Please check. I've not tested this to see how it works. This may help you.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
