File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -222,28 +222,37 @@ if [ ${leave_mounted} -eq 0 ]; then
222222 fi
223223
224224 # invoke logrotate to rotate over old pool db backups
225- echo -n " Rotating old backups: "
225+ echo -n " Rotating old DB backups: "
226226 logrotate -f " ${lrconf} "
227227 num_found=$( find " ${mnt} " -name ' *.db.*' | wc -l)
228228 echo " found ${num_found} "
229229
230230 # perform the pool database dump
231231 echo -n " Backing up pool database: "
232232 ${XE} pool-dump-database file-name=" ${mnt} /${pool_uuid} .db"
233- echo done
233+ echo " done"
234+
235+ # clean the old pool database dump
236+ echo -n " Cleaning old DB backups: "
237+ todelete=$( cd " ${mnt} " && ls -1tr ${pool_uuid} .db* | head -n -" ${history_kept} " | xargs echo)
238+ for dbfile in ${todelete} ; do
239+ rm -f " ${mnt} /${dbfile} "
240+ done
241+ echo " done"
234242
235243 # backup the VM metadata for each VM in the pool into a dated directory
236244 datetime=$( date +%F-%H-%M-%S)
237245 metadir=" ${mnt} /metadata/${datetime} "
238246 mkdir -p " ${metadir} "
239247 echo -n " Cleaning old VM metadata: "
240248 IFS=" "
241- todelete=$( cd " ${mnt} /metadata" && ls -1 | sort -n | head -n -${history_kept} | xargs echo)
249+ todelete=$( cd " ${mnt} /metadata" && ls -1 | sort -n | head -n -" ${history_kept} " | xargs echo)
242250 for dir in ${todelete} ; do
243251 rm -rf " ${mnt} /metadata/${dir} "
244252 done
245- echo done
253+ echo " done"
246254 IFS=" ,"
255+
247256 echo -n " Backing up SR metadata: "
248257 mkdir -p " ${metadir} "
249258 " @LIBEXECDIR@/backup-sr-metadata.py" -f " ${metadir} /SRMETA.xml"
You can’t perform that action at this time.
0 commit comments