Jamie Dobbs wrote:
I would like to set up a simple "backup script" that will tar/gzip the contents of the ~/Maildir directories of several users on one of my Linux boxes.
What is the best way to do this so that I preserve ownership/groups etc. so that when I need to restore it is a trivial process? Keep in mind that each ~/Maildir can have multiple hidden sub-directories.
Cheers
Jamie
tar and gzip can be combined using the z flag ( and also compression via bzip2 using the j flag ). All ownership details are retained, and will be restored if the p flag is used when recovering the data.
This makes the solutions much simpler than using cpio, for which you need a large manual to get all the options correct.
If you're creating a script that you're intending to run automagically from cron, remember that the environment that you normally run in doesn't exist. Practically this means that you'll need either to set up the PATH variable so that all the commands ( find, tar, etc ) are found, or to explicitly state the path for each command ( eg /bin/tar ).
Also, the amanda package may also be of some use to you. It used to be all free, but it now is far too important for that, but I think it is still free for a single server solution to either disk or industry standard tape device ( was last time I looked, but that was a few years ago ).
HTH,
Steve
