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
222
222
fi
223
223
224
224
# invoke logrotate to rotate over old pool db backups
225
- echo -n " Rotating old backups: "
225
+ echo -n " Rotating old DB backups: "
226
226
logrotate -f " ${lrconf} "
227
227
num_found=$( find " ${mnt} " -name ' *.db.*' | wc -l)
228
228
echo " found ${num_found} "
229
229
230
230
# perform the pool database dump
231
231
echo -n " Backing up pool database: "
232
232
${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"
234
242
235
243
# backup the VM metadata for each VM in the pool into a dated directory
236
244
datetime=$( date +%F-%H-%M-%S)
237
245
metadir=" ${mnt} /metadata/${datetime} "
238
246
mkdir -p " ${metadir} "
239
247
echo -n " Cleaning old VM metadata: "
240
248
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)
242
250
for dir in ${todelete} ; do
243
251
rm -rf " ${mnt} /metadata/${dir} "
244
252
done
245
- echo done
253
+ echo " done"
246
254
IFS=" ,"
255
+
247
256
echo -n " Backing up SR metadata: "
248
257
mkdir -p " ${metadir} "
249
258
" @LIBEXECDIR@/backup-sr-metadata.py" -f " ${metadir} /SRMETA.xml"
You can’t perform that action at this time.
0 commit comments