--- /dev/null
+#!/bin/sh
+
+mailto=carl@ecbaldwin.net
+dev="/dev/hdc"
+sdev="ATA:1,0,0"
+imagedir="/backup/imgs"
+
+img=$(ls $imagedir | head -n 1)
+echo $img
+
+if [ -n "$img" ]; then
+ if cdrecord-wrapper.sh -dao speed=8 dev=$sdev $isoimage; then
+ md5sum=$(tempfile)
+ dd if=$dev bs=1M count=4440 | md5sum | awk '{print$1}' > $md5sum
+ if ! cmp $md5sum $isoimage.md5sum; then
+ echo "Failed" | mailx -s "DVD md5sum doesn't match image file!!!" $mailto
+ exit 1
+ else
+ echo $md5sum >> $img.stat
+ fi
+ else
+ echo "Failed" | mailx -s "DVD burning failed!!!" $mailto
+ exit 1
+ fi
+
+ if [ "$(wc -l $img.stat 2>/dev/null)" == "2" ]; then
+ echo "Burned the image twice. Removing it!"
+ rm -f $img{,.md5sum,.stat}
+ rmdir $img.mnt
+ fi
+fi