Skip to content

Commit

Permalink
fix: busybox compatible date manipulation
Browse files Browse the repository at this point in the history
The date manipulation did not work in my tests with busybox on
OpenShift.

This should work even in the busybox environments. It simply subtracts
seconds.
  • Loading branch information
in0rdr committed Sep 12, 2024
1 parent 56214a5 commit 1e3ad45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kubernetes/vault-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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 "${S3_EXPIRE_DAYS} days ago" +%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
Expand Down

0 comments on commit 1e3ad45

Please sign in to comment.