3 scriptsdir=$(dirname $0)
4 bindir="$scriptsdir/../build"
6 export PATH=$scriptsdir:$bindir:$PATH
8 # file locations and other values
9 today=$(date +%Y%m%d%H%M%S)
10 datadir="/var/lib/backups"
11 tmpdir="/dev/shm/backups"
12 currentfiles="$tmpdir/files.db"
13 backupdb="$datadir/backups.db"
14 backups="$tmpdir/backup-list.db"
15 statusfile="$tmpdir/backup-status.txt"
16 isomountdir="/backup/iso-mount"
17 isoimage="/backup/iso-mount.iso"
19 echo "Creating the iso image in $isoimage"
23 # Create filesystem on iso image here
24 dd if=/dev/zero of=$isoimage bs=2048k count=2220
25 mke2fs -b 2048 -F $isoimage
27 echo "Mounting the iso image"
28 # Mount iso image here
29 mount -t ext2 -o loop $isoimage $isomountdir
35 chmod 600 $currentfiles
36 echo "Running find to get the status of files"
37 find-cmd.sh /home > $currentfiles
39 echo "Determining list of files to backup with lsbackups"
41 # lsbackups expects the current date followed by a null before the list of files
44 } | lsbackups > $backups 2>$statusfile
46 echo "Running rsync to pack the image"
47 cat $backups | rsync-cmd.sh $isomountdir
49 echo "Copying over database and status file"
50 cp $statusfile $backupdb $isomountdir
55 # dvdrecord [-dummy] [-overburn] -dao speed=8 dev=[ATAPI:]?,?,? iso-image.iso
56 cat $statusfile | mailx -s "DVD Image available on ball, burn it!" carl@ecbaldwin.net