From: Carl Baldwin Date: Thu, 27 Oct 2005 01:26:59 +0000 (-0600) Subject: Add burning to the drive script X-Git-Tag: release-0.4~53^2 X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/static/%7Bupdate_day%7D?a=commitdiff_plain;h=c56f7393d14263e06a1a4425fc5a855679b68831;p=backups%2F.git Add burning to the drive script --- diff --git a/scripts/drive.sh b/scripts/drive.sh index 9f17f83..7d0420d 100755 --- a/scripts/drive.sh +++ b/scripts/drive.sh @@ -6,6 +6,7 @@ export PATH=$scriptsdir:$PATH # file locations and other values today=$(date +%Y%m%d%H%M%S) +mailto='carl@ecbaldwin.net' datadir="/var/lib/backups" tmpdir="/dev/shm/backups" currentfiles="$tmpdir/files.db" @@ -13,7 +14,7 @@ backupdb="$datadir/backups.db" backups="$tmpdir/backup-list.db" statusfile="$tmpdir/backup-status.txt" isomountdir="/backup/iso-mount" -isoimage="/backup/ISOs/$today.iso" +isoimage="/backup/ISOs/$today.img" restorescript="$scriptsdir/restore.sh" echo "Creating the iso image in $isoimage" @@ -55,14 +56,25 @@ cat $backups | rsync $rsyncopts / $isomountdir echo "Copying over database and status file" cp $statusfile $backupdb $restorescript $isomountdir -mount -o remount -o ro $isomountdir -# Should be -# umount $isomountdir +echo "Unmounting image" +umount $isomountdir -md5sum $isoimage > $isoimage.md5sum +echo "Calculating md5sum for image" +md5sum $isoimage | awk '{print$1}' > $isoimage.md5sum # Burn the iso image -# dvdrecord [-dummy] [-overburn] -dao speed=8 dev=[ATAPI:]?,?,? iso-image.iso +echo "Burn the image to a DVD" +if cdrecord-wrapper.sh -dao speed=8 dev=ATA:1,0,0 $isoimage; then + md5sum_file=$(tempfile) + dd if=/dev/hdc bs=2048k count=2220 | md5sum | awk '{print$1}' > $md5sum_file + if ! cmp $md5sum_file $isoimage.md5sum; then + echo "Failed" | mailx -s "DVD md5sum doesn't match image file!!!" $mailto + exit 1 + fi +else + echo "Failed" | mailx -s "DVD burning failed!!!" $mailto + exit 1 +fi # Email me -cat $statusfile | mailx -s "DVD Image available on ball, burn it!" carl@ecbaldwin.net +cat $statusfile | mailx -s "DVD burned. File it as $today" $mailto