Mr. Self Destruct
Posted on 12th June 2008
Picked up a useful procmail tip the other day, and thought I'd help to promote it here. See Filtering mail with procmail for more details. As I hadn't done a cleanup of my backup mail files for some time, I was using up 1.5GB of disk space for messages that had already been processed. Most of the mails were spam, which have since been deleted. However, figuring out which files to delete is awkward as they all get named using the format of 'msg.XXXX', where XXXX is a random set of alphanumeric characters. This little tip, collates all the days mail into a single file, thus making it much easier to delete archives. I can now set up a cron job to delete month old archives once a month and keep my disk space at a more manageable level.
#
# Used for keeping a backup of each days mail.
#
BACKUP=$MAILDIR/backup
TODAY=`date +%d-%m-%Y`
#
# Save a copy of each email received into a file of the form
# '~/Mail/backup/dd-mm-yyyy'.
#
:0 c:
$BACKUP/$TODAY
File Under:
backups
/ email
/ linux
|
History Never Repeats
Posted on 5th June 2007
It's always handy doing backups, but getting into the habit of doing them is another thing. I've mostly just used a simple bash script, run manually when I need to. Which isn't what I should be doing. Today I decided it was about time I organsied soemthing to officially backup the databases. At the moment I'm only backing up the MySQL databases, but will add the one postgresql DB once it's been rehosted.
Originally I was going to use automysqlbackup, which may well have worked, but looked a bit too much work to do a relatively simple job, only supported MySQL and didn't enable me to backup via ssh to multiple servers. As the data potentially contains private information, sending via email is not an option. So I wrote my own. The result is a program a tenth of the size of automysqlbackup, it's written in Perl, backs ups multiple sites to multiple servers and the only non-core module is Net::SCP :)
Once I've added the necessary PostgreSQL support and written some documentation, I'll put it online somewhere.
File Under:
backups
/ database
|