diff --git a/vmbackup.sh b/vmbackup.sh index f2438f7..afc8c24 100755 --- a/vmbackup.sh +++ b/vmbackup.sh @@ -4,6 +4,7 @@ set -e set -u set -o pipefail +retention=2 statusfile=/var/run/zabbix/vmbackup.status basedir=/mnt/backups/vms vbm="sudo -u cig vboxmanage" @@ -52,7 +53,7 @@ if ( checkRunning $machine ) ; then ret=$? test $ret -eq 0 || _mail "rsync error $ret" $vbm startvm $machine - test $ret -eq 0 && find ${basedir} -maxdepth 1 -type d -mtime +7 -exec echo rm -fr {} \; + test $ret -eq 0 && find ${basedir} -maxdepth 1 -type d -mtime +${retention} -exec echo rm -fr {} \; umount /mnt/backups &> /dev/null || _mail "umount failed" _mail "backup done with status $ret" _exit "backup done" $ret