openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting » Script To Backup Maildir Folders In Home Areas

Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-Apr-2008, 05:03
GuyWood13
Guest
 
Posts: n/a
Default

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
  #2 (permalink)  
Old 11-Apr-2008, 05:34
ken_yap
Guest
 
Posts: n/a
Default

All user accounts have only one top Maildir directory which would be something like /home/somebody/Maildir or /home/somebody/Mail, depending on how you have set up your SMTP and IMAP servers.

So all you need to do is something like this:

cd /home
tar cf - */Maildir | (cd /backup/home; tar xf -)

and lots of other possibilities.
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2