Our server's directory structure is like this
- etc...(it's the standard when using virtualmin)
What I want to schedule backups for is the public_html directories + some files at the site1/ level (there are often some handy scripts written in those levels, but also there are inevitably a bunch of bloat files there too like temp db dumps that I don't want filling up the backup server every job)
Here's what I would like to do if possible (from /home/):
tar -cz --include="*.sh" --include="*.php" --include="public_html/*" ./site1/ | ssh backupserver ...
But, tar doesn't have an include option, only exclude.
find ./site1/ -type f -name "*.sh" -or -name "*.php" -or -wholename "./site1/public_html/*" | xargs tar -cz | ssh backupserver ...
But that doesn't work either because xargs breaks a large list of files into chunks, causing every restart of the tar -c command to overwrite the previous file (and if I don't use xargs, then there is an error for the list being too long).
I can't use the -r option to append to the backup because 1) it doesn't work on compressed archives and 2) I don't think that could work across ssh anyway.
The only solution I can think of is to break it into steps creating a temporary tar file locally (one to tar ./site1/public_html/ and another to append ./site1/*.[sh|php]), then zipping, then ssh, then delete the local file. But that seems almost ridiculous on linux.
Is there some format to the tar command that I can use that I'm missing?