Added available disk space check & new backupeveryXdays config var. release-0.4
authorAlan Jack Pippin <ajp@pippin.(none)>
Fri, 2 Dec 2005 03:56:10 +0000 (20:56 -0700)
committerAlan Jack Pippin <ajp@pippin.(none)>
Fri, 2 Dec 2005 03:56:10 +0000 (20:56 -0700)
scripts/config.sh
scripts/cron-pack.sh
scripts/pack-image.sh

index ff58479670bc1506ef28292b4e9c757ac2d7060e..c676f093d18bece30b2a0ae718b5bb0087310628 100755 (executable)
@@ -11,6 +11,7 @@ lastbackupfile="$imagedir/lastbackup"
 dev="/dev/dvdrw"
 sdev="ATA:1,0,0"
 noburnfile="$imagedir/noburn"
+backupeveryXdays=15
 
 # These are exported so lsbackups can have access to them
 export backupdbin="$datadir/backups.db"
index 906b010ac1c15048a5cda03e48174df938c8f3fd..f34489a0d3d59ac909b0d228a7c3d5435556b3de 100755 (executable)
@@ -8,8 +8,7 @@ export PATH=$(dirname $0):/bin:/usr/bin:/sbin
 # source the system specific configuration
 [ -f /etc/lsbackups.conf ] && . /etc/lsbackups.conf
 
-days=15
-minutes=$(($days * 1440 - 60))
+minutes=$(($backupeveryXdays * 1440 - 60))
 
 if [ -n "$(find $lastbackupfile -mmin +$minutes)" -o -n "$(cat $statusfile | grep -i incomplete)" ]; then
   echo "Running backups from cron..."
index 2bdb75e920134b46ee49e9d8ca9756eae10d93c6..ce985fa2eb13c00d93cfd11ec07faa36af7b3393 100755 (executable)
@@ -22,6 +22,11 @@ isoimage="$imagedir/$today.iso"
 isomountdir="$isoimage.mnt"
 restorescript="$scriptsdir/restore.sh"
 
+echo "-> Checking for available disk space on $imagedir"
+available=$(df $imagedir | awk '{print$4}' | grep -E "[0-9]+")
+required=$((imagesizemb*1024))
+[ $required -gt $available ] && err "Not enough space for the backup image on $imagedir"
+
 echo "-> Creating directories"
 mkdir --mode=700 -p $datadir $imagedir $isomountdir $tmpdir
 if [ $? != 0 ]; then