X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=backup.sh;h=2a6d66693033a6505e228122917343448e1ee9b8;hb=193cb1034eb79f624d39b02bb02ee696ede2ac1b;hp=0e230399b4ed6be81fe2767139520ce439642e49;hpb=2963d003c1f7b4795ee38443f1b47ce0c8a4daf8;p=backup.sh diff --git a/backup.sh b/backup.sh index 0e23039..2a6d666 100755 --- a/backup.sh +++ b/backup.sh @@ -202,8 +202,7 @@ if ! ssh root@$computer "[ ! -f /root/.backup/preexec ] || /bin/bash -x /root/.b diemsg "Could not run $computer:/root/.backup/preexec" fi -for filesystem in $filesystems -do +for filesystem in $filesystems; do # Remove / and $ (for Windows) for path names sfilesystem=`echo $filesystem | tr '\/\$' '__'` @@ -247,15 +246,16 @@ do backup # Check if this box has a custom number of full backups - if [ -f $confdir/maksfulle.$computer ] ; then + if [ -f $confdir/maksfulle.$computer.$sfilesystem ]; then + mf=$((`cat $confdir/maksfulle.$computer`+1)) + elif [ -f $confdir/maksfulle.$computer ] ; then mf=$((`cat $confdir/maksfulle.$computer`+1)) else mf=$(($maxnumfull+1)) fi # Delete old full backups - for full in `ls -1t $storagedir/$computer/$sfilesystem/full/*tgz | tail -n +$mf` - do + for full in `ls -1t $storagedir/$computer/$sfilesystem/full/*tgz | tail -n +$mf`; do prefix=`echo $full | sed "s/\.[^.]*$//"` echo `date`": $computer:$filesystem Deleting full backup $prefix" >&2 rm $prefix*