Type your search keyword, and press enter

Whats on my Podcatcher?

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

What are my current favourite podcasts?

  1. Mysterious Universe – Brilliant podcast covering pretty much every aspect of the paranormal, but not overly serious and no signs of any tin foil hats!
  2. Linux Outlaws – Superbly fun podcast, covering the latest news in the Linux, Open source and free software world with the (more than) occasional rant from Fab.
  3. Ubuntu UK Podcast – Another easy going Linux (Ubuntu centric) podcast, good bunch of presenters, covers the latest news in the Ubuntu world.
  4. Little Atoms – A very interesting podcast, each cast is an interview with highly intelligent folks, mainly science based but not always.
  5. TDTRS – The Dick Turpin Roadshow, another Linux/Free software based podcast but very entertaining.
  6. BBC Click – Technology focussed podcast from the BBC, fairly low tech level but interesting nonetheless.
  7. Rathole Radio – Music based podcast, not mainstream music but collected from around the web. Creative commons music features highly in this cast, presented by Dan who is also from Linux Outlaws(2).
  8. Little Atoms Road Trip – Spin off from the Little Atoms (4) podcast, featuring interviews Neil Denney recorded during a road trip through the US.
  9. Corsten’s Countdown – Trance DJ Ferry Corstens weekly podcast showcasing his radio show with a top 3 based on web voting from the previous week.
  10. A State of Trance – as above (9) but with Armin van Buuren

I do listen to a few others but these seem to take precedence. Numbers 1 and 2 are pretty much joint first, but depends on  my mood. I will always push them both to the top of the playlist when they are downloaded.

If anyone is interested I listen to these using BeyondPod on my Android phone.

Hourly Backup Script for Email

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

So I was working on a script a while ago to backup all my email on my Linux box. I put together a fairly simple bash script to delve into home directories and pick out the Maildir and back it up. Great!

DRIVE=”/dev/sdb1″
HOME=”/home/”
LIST=”/tmp/backlist_$$.txt”
#
mount $DRIVE /backup
set $(date)
for DIR in `find /home/ -name “Maildir” -print`; do
NAME=`echo $DIR|awk -F\/ {‘ print $3 ‘}`
tar vcfz “/backup/Mail/mail_full_${NAME}_$6-$2-$3.tgz” $DIR
umount /backup

So it was doing a full backup each day, which quickly became stoopid in size, so I decided to go for a weekly full and daily differentials.

DRIVE=”/dev/sdb1″
HOME=”/home/”
LIST=”/tmp/backlist_$$.txt”
#
mount $DRIVE /backup
set $(date)
#
if test “$1” = “Sat” ; then
# weekly a full backup of all data and config. settings:

#Backup of users Mail Directories
for DIR in `find /home/ -name “Maildir” -print`; do
NAME=`echo $DIR|awk -F\/ {‘ print $3 ‘}`
tar vcfz “/backup/Mail/mail_full_${NAME}_$6-$2-$3.tgz” $DIR
done
rm -f /backup/home/Mail/mail_diff*
#Daily differential backup
else
# incremental maildir
for DIR in `find /home/ -name “Maildir” -print`; do
NAME=`echo $DIR|awk -F\/ {‘ print $3 ‘}`
find $DIR -depth -type f \( -ctime -1 -o -mtime -1 \) -print > $LIST
tar vcfzT “/backup/Mail/mail_diff_${NAME}_$6-$2-$3.tgz” “$LIST”
done

fi
sleep 5
umount /backup

Nice! So now I’ve got a nice little backup solution. I have a function which rotates which I have yet to add. Then it will be nearly perfect…

 

Or will it?

So what happens if I recieve an email during the day, then accidentally delete it before the daily backup?? err…. uh-oh!

OK so a secondary mail store now would work a treat

for DIR in `find /home/ -name “Maildir” -print`; do
NAME=`echo $DIR|awk -F\/ {‘ print $3 ‘}`
/usr/bin/rsync -a $DIR/. /backup/Maildirs/$NAME/Maildir/ –delete -exclude=”dovecot.index*” –exclude=”dovecot-uidlist”
done

Dropping that in a seperate script and adding an hourly cron job would make sure I could go back an hour. But only an hour… hmm

So utilising a magic feature of the *nix filesystem inodes, I created a section which will copy using hardlinks several generations of the files but only actually store any differences thus not eating up precious disk space…

for DIR in `find /home/ -name “Maildir” -print`; do
NAME=`echo $DIR|awk -F\/ {‘ print $3 ‘}`
# NAME=”accounts”
echo “Running hourly backup for $NAME”
mv /backup/Maildirs/$NAME/Maildir.{12,tmp}
mv /backup/Maildirs/$NAME/Maildir.{11,12}
mv /backup/Maildirs/$NAME/Maildir.{10,11}
mv /backup/Maildirs/$NAME/Maildir.{9,10}
mv /backup/Maildirs/$NAME/Maildir.{8,9}
mv /backup/Maildirs/$NAME/Maildir.{7,8}
mv /backup/Maildirs/$NAME/Maildir.{6,7}
mv /backup/Maildirs/$NAME/Maildir.{5,6}
mv /backup/Maildirs/$NAME/Maildir.{4,5}
mv /backup/Maildirs/$NAME/Maildir.{3,4}
mv /backup/Maildirs/$NAME/Maildir.{2,3}
mv /backup/Maildirs/$NAME/Maildir.{1,2}
mv /backup/Maildirs/$NAME/Maildir.{0,1}
mv /backup/Maildirs/$NAME/Maildir.{tmp,0}
cp -al /backup/Maildirs/$NAME/Maildir.{1/.,0}
/usr/bin/rsync -a $DIR/. /backup/Maildirs/$NAME/Maildir.0/ –delete -exclude=”dovecot.index*” –exclude=”dovecot-uidlist”
echo `date` >/backup/Maildirs/$NAME/Maildir.0/dumptime
done

I probably could have made this a lot more elegant (and probably will put a loop in there) but for now it does the trick. It keeps 12 hourly generations of the backup but really only stores the full copy once and the differences between each generation in the copies by hardlinking the files to the same inodes rather than creating new copies each time.

My next task to make this even better is to integrate the 2 scripts, pretty them up and use hourly/daily/weekly versions rather than the tarballs.