--- /dev/null
+Need to have backup group.
+Mail daemon should be a member of the backup group and the group of the DVD writer in order to eject the disk.
+/backup and subdirectories should have mode 660 with group sticky bit set.
 
 
 . config.sh
 
+# If the noburn file is there then don't burn.
+[ -f "$burnlockfile" ] && exit 0
+
 # Discover disk images by looking for .img.md5sum files in $imagedir
 imgmd5=$(ls $imagedir/*.img.md5sum | head -n 1)
 
 logfile=$(tempfile)
 
-# If the noburn file is there then don't burn.
-[ -f "$burnlockfile" ] && exit 0
-
 # If we didn't find an non-empty file then exit gracefully
 [ -z "$imgmd5" ] && exit 0
 [ -s "$imgmd5" ] || exit 0
 
 statusfile="$tmpdir/backup-status.txt"
 imagedir="/backup/imgs"
 lastbackupfile="$imagedir/lastbackup"
-dev="/dev/hdc"
+dev="/dev/dvdwr"
 sdev="ATA:1,0,0"
 burnlockfile="$imagedir/noburn"
 
 
 
 echo "Creating directories"
 mkdir --mode=700 -p $datadir $imagedir $isomountdir $tmpdir
+chgrp backup $imagedir
+chmod g+s    $imagedir
+chmod g+w    $imagedir
 
 echo "Creating the iso image in $isoimage"
 dd if=/dev/null of=$isoimage bs=1M count=0 seek=4440