From: Alan Jack Pippin Date: Fri, 2 Dec 2005 03:56:10 +0000 (-0700) Subject: Added available disk space check & new backupeveryXdays config var. X-Git-Tag: release-0.4^0 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/%7Blink_ppi%7D?a=commitdiff_plain;h=26208191cbd7c6ec3f79f9cfd863b78d323eaacf;p=backups%2F.git Added available disk space check & new backupeveryXdays config var. --- diff --git a/scripts/config.sh b/scripts/config.sh index ff58479..c676f09 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -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" diff --git a/scripts/cron-pack.sh b/scripts/cron-pack.sh index 906b010..f34489a 100755 --- a/scripts/cron-pack.sh +++ b/scripts/cron-pack.sh @@ -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..." diff --git a/scripts/pack-image.sh b/scripts/pack-image.sh index 2bdb75e..ce985fa 100755 --- a/scripts/pack-image.sh +++ b/scripts/pack-image.sh @@ -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