NSLU2-Linux
view · edit · print · history

Using getmail you can easily backup your Gmail with your NSLU2.

Procedure

Enable POP on your Gmail account. If you want to backup mails already received in your Gmail account (archived or not), don't forget to select "Enable POP for all mail". Choose to "keep Gmail's copy in the inbox" "when messages are accessed with POP".

Install getmail on your NSLU2.

 # ipkg install getmail

Create the .getmail directory in your root's $HOME on your NSLU2 (using Telnet or SSH).

 # mkdir ~/.getmail

In the .getmail directory, create the getmailrc file with the following content:

 [retriever]
  type = SimplePOP3SSLRetriever
  server = pop.gmail.com
  password = yourGmailPassword
  username = yourGmailAccount@gmail.com
  delete_dup_msgids = True

 [destination]
  type = Mboxrd
  path = /share/hdd/data/public/yourGmailAccount@gmail.com.mbox
  user = yourNsluUser

Remplace yourGmailPassword, yourGmailAccount@gmail.com, yourNsluUser with the correct value. yourNsluUser must be the login of an existing user on your NSLU2.

Create the /share/hdd/data/public/yourGmailAccount@gmail.com.mbox file and give it to your NSLU2 user.

 # touch /share/hdd/data/public/backup-mails/yourGmailAccount@gmail.com.mbox
 # chown yourNsluUser:501 /share/hdd/data/public/yourGmailAccount@gmail.com.mbox

Add getmail in your crontab

 # echo "0 0-23/4 * * * * root /opt/bin/getmail &>/dev/null" >> /etc/crontab

Comments

  • You can create the .getmail directory in your user $HOME if it exists. If you do, you cant omit "user = yourNsluUser" in getmailrc but set up getmail to be runned by your user in your crontab ("0 0-23/4 * * * * yourNsluUser /opt/bin/getmail &>/dev/null").
  • You can put your backup (the .mbox) file anywhere on your NSLU2 using anything as it's name. I used the account name in the public directory as an example that should work on any system and makes the backup available using the standard Shares configuration.
  • You can have several config file and several lines in your crontab using the -r option.
  • mboxrd can directly be used by most email client. getmail offers others destination types such as Maildir or an MDA, check it's documentation for more information.
  • This setup will check for new mail every 4 hours. Off course, you can change this as you like (check crontab documentation).
  • Instead of the new .mbox file, you can use an existing mboxrd from your mail client.
  • You should ensure that all other programs accessing the .mbox file expect mboxrd-format mbox files and fcntl-type file locking; failure to do so can cause mbox corruption.
view · edit · print · history · Last edited by mongolito404.
Originally by mongolito404.
Page last modified on May 07, 2006, at 10:46 AM