File tree 1 file changed +1
-10
lines changed
1 file changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -231,18 +231,9 @@ clean_old_backups() {
231
231
echo " Removing old backups"
232
232
233
233
local s3_backup_list
234
- local backup_files=()
235
234
236
235
s3_backup_list=$( s3cmd --config=/root/.s3cfg ls s3://" ${S3_BUCKET}${TARGET_DIR} /" | awk ' {print $4}' )
237
-
238
- while IFS= read -r file; do
239
- if [[ ! " $file " =~ _inc ]]; then
240
- backup_files+=(" $file " )
241
- fi
242
- done <<< " $s3_backup_list"
243
-
244
- mapfile -t backup_files < <( echo " $s3_backup_list " | grep -v ' _inc' )
245
- mapfile -t sorted_backup_files < <( printf " %s\n" " ${backup_files[@]} " | sort -t' /' -k4)
236
+ mapfile -t sorted_backup_files < <( echo " $s3_backup_list " | grep -v ' _inc' | awk -F' /' ' {print $NF, $0}' | sort | awk ' {print $2}' )
246
237
247
238
if [[ ${# sorted_backup_files[@]} -gt $ROLLING_WINDOW_HR ]]; then
248
239
local cutoff_index=$(( ${# sorted_backup_files[@]} - $ROLLING_WINDOW_HR ))
You can’t perform that action at this time.
0 commit comments