For files a few MB in size, users can do backups to their google mail using their local cron. "Few MB"? What does "few" mean? Well, we have a back-end that uses Google mail, and google has 20MB as their message size limit. So we're talking around 20MB, less the encoding overhead. MIME-encoding, the encoding standard for this sort of thing expands a file. So in practice, the file size limit is probably about 17MB. Why have a limit anyway? This is because mail is a terrible way to do file transfer (google for more on this). So having some limit is a good thing to run into. Remember, every time you do a file transfer with email, a techie cries.
OK, so google allows a message size of 20MB. What about at the other end, where the mail is sent to google? On our development box, we use postfix, which has a default of 10MB. To crank it up to 20MB, add: message_size_limit = 20480000 in main.cf. (I placed it just after the mailbox_size_limit line). After a postfix reload, postfix on our box, too, can send a 20MB-sized message. Now the remaining part becomes an exercise in userspace scripting for cron:
Here's the script for doing a backup of the current data dump:
#!/bin/sh #backup to a file, unimaginatively named backup.tgz tar czf /home/pj/backup.tgz /home/pj/datadumps #Mailing a tgz file to google won't work because google doesn't like those kind of attachments #( http://mail.google.com/support/bin/answer.py?answer=6590) #solution: encrypt the file to be mailed #(with the kind of password an idiot would put on his luggage is good enough) gpg -c --passphrase 12345 /home/pj/backup.tgz -o /home/pj/backup.tgz.gpg #Let's time stamp it for convenience: TSTAMP=`date | tr " " "_" | tr ":" "_"` mv /home/pj/backup.tgz.gpg /home/pj/backup.tgz.gpg.$TSTAMP #Sending it as an attachment: Use this construction: mutt -s "today's backup" -a /home/pj/backup.tgz.gpg.$TSTAMP pj.spambait@srijan.in < /home/pj/some_bodytextfile #some_bodytextfile is just a file with some text that will go in the mail body. #pj.spambait@srijan.in is your destination sender address
Put the above in a daily cron and you have a daily backup. Caveat: add $EMAIL to the user and cron environments if mutt still won't work for you: export EMAIL=pj.spambait@srijan.in That's it. Offsite back up with minimal effort. PJ