Skip to content

Commit

Permalink
fix: shell syntax and filename
Browse files Browse the repository at this point in the history
  • Loading branch information
in0rdr committed Sep 12, 2024
1 parent 9823e9c commit 6336461
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kubernetes/vault-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ if [ "${S3_EXPIRE_DAYS}" ]; then
s3cmd ls "${S3_URI}" --host="${S3_HOST}" --host-bucket="${S3_BUCKET}" | while read -r line; do
createDate=$(echo "$line" | awk '{print $1" "$2}')
createDate=$(date -d"$createDate" +%s)
olderThan=$(date --date @$(($(date +%s$) - 86400*$S3_EXPIRE_DAYS)) +%s)
olderThan=$(date --date @$(($(date +%s) - 86400*$S3_EXPIRE_DAYS)) +%s)
if [ "$createDate" -lt "$olderThan" ]; then
fileName=$(echo "$line" | awk '{print $4}')
if [ "$fileName" != "" ]; then
s3cmd del "${S3_URI}/$fileName" --host="${S3_HOST}" --host-bucket="${S3_BUCKET}"
s3cmd del "$fileName" --host="${S3_HOST}" --host-bucket="${S3_BUCKET}"
fi
fi
done;
Expand Down

0 comments on commit 6336461

Please sign in to comment.