From d584dcdbb9f5dce4fe36bf31932b4f753633c4c2 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Fri, 12 Oct 2012 17:27:45 -0600 Subject: [PATCH] bpcdump: allow removal of any VE backup When looking to free space for the new backup, allow removal of older backups for any VE, not just for the current VEID. Since the typical use case now is to back up just a single BackupPC container, a change in VEID is going to be due to a replacement BackupPC container, such as in a major upgrade scenario. If these scripts are in fact used in the future to back up multiple BackupPC containers, additional work will be required on the script. --- bpcdump | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bpcdump b/bpcdump index 2db202c..90ecd02 100755 --- a/bpcdump +++ b/bpcdump @@ -147,11 +147,12 @@ else fi # Before we begin writing, remove old backup dirs until we have room. +# Assume backups for any VE are fair game for removal if space is needed. # Other disk contents shall not be removed. dstblks=$(df -P "$EXTFS" | grep "$EXTFS" | awk '{ print $4 }') while [ $dstblks -le $srcblks ]; do info "Only $dstblks free on $EXTFS" - oldest=$(cd $EXTFS && eval ls -td "ve${VEID}*" 2>/dev/null | tail -1) + oldest=$(cd $EXTFS && eval ls -td "ve[0-9]*" 2>/dev/null | tail -1) if [ -z "$oldest" ]; then cleanup 1 "out of space: need $srcblks KB, have $dstblks KB" elif [ -d "$EXTFS/$oldest" ]; then -- 2.39.2