Added available disk space check & new backupeveryXdays config var.
[backups/.git] / scripts / cron-pack.sh
index 62c65ad746dcac88e2bb5413ab212694e88bd1db..f34489a0d3d59ac909b0d228a7c3d5435556b3de 100755 (executable)
@@ -6,12 +6,11 @@ export PATH=$(dirname $0):/bin:/usr/bin:/sbin
 . config.sh
 
 # source the system specific configuration
-if [ -f /etc/lsbackups.conf ]
-then
-  . /etc/lsbackups.conf
-fi 
+[ -f /etc/lsbackups.conf ] && . /etc/lsbackups.conf
 
-if [ -n "$(find $lastbackupfile -mtime +14)" -o -n "$(cat $statusfile | grep -i incomplete)" ]; then
+minutes=$(($backupeveryXdays * 1440 - 60))
+
+if [ -n "$(find $lastbackupfile -mmin +$minutes)" -o -n "$(cat $statusfile | grep -i incomplete)" ]; then
   echo "Running backups from cron..."
   setsid pack-image.sh
   exit 0