Results 1 to 3 of 3
Hi
I'm looking for a bash shell, php or perl script to backup all /home/username/Maildir directories (and there content) within the /home/ directory to another folder location such as /backup/username/Maildir. ...
- 04-11-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 3
Script to backup Maildir email within Home areas
Hi
I'm looking for a bash shell, php or perl script to backup all /home/username/Maildir directories (and there content) within the /home/ directory to another folder location such as /backup/username/Maildir. This will enable me to backup emails within my postfix mail server environment.
I've already got an idea of what the program should do and I'm assuming to somebody in the know that it would be easy.
-It needs read the contents of the /home dir to find all the directories that contain a Maildir directory
-then somehow stick all these into an array or something
-then in a loop feed in all the values and run a cp command on top level directory (/home/username) and then a cp on the Maildir directory (and all its contents). Obviously this would have to contain the mkdir command to generate the new folders in the location its backing up to.
-And when all are copied, come out of the loop and end the script
I've never really done any scripting and don't have a scooby doo where to start but with my basic knowledge of programming, I have a rough idea of what is needed.
So if anybody could point me in the direction of some good resources, get me started or even better, just write it for me - that would be absolutely fantastic! Seriously though, any help would be much appreciated.
Thanks
- 04-11-2008 #2Just Joined!
- Join Date
- Apr 2008
- Posts
- 20
You can try to create a file content this:
you can also put a link to this file in cron to make it an automatically backupPHP Code:tar -zcf /backupfolder/mail.tar.gz /home/ */MailDir

Note: Remove the space after /home/ , I added it because of replay submit filter
- 04-12-2008 #3Just Joined!
- Join Date
- Mar 2008
- Posts
- 3
Thanks kdman, I'll give this a whirl and let you know how it goes.


Reply With Quote