diff --git a/check_cloud_storage.sh b/check_cloud_storage.sh index 1ac8122a1f74d621501ef54256e0498b75ef8ca6..b8148452a05b03ab750ab209f74d50092813b916 100755 --- a/check_cloud_storage.sh +++ b/check_cloud_storage.sh @@ -12,7 +12,7 @@ do BYTES=$(grep "Bytes:" $file | cut -d ":" -f 2 | tr -d " ") OBJECTS=$(grep "Objects:" $file | cut -d ":" -f 2 | tr -d " ") LAST_FILE=$(tail -2 $file | grep gpg) - if [ `date -d "${LAST_FILE:5:19}" +%s` -gt `date -d '7 days ago' +%s` ] + if [ `date --utc --date "${LAST_FILE:5:19}" +%s` -gt `date --utc --date '7 days ago' +%s` ] then OUTPUT+="OK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Modified: ${LAST_FILE:5:19}\n" else diff --git a/check_newest_file_age.sh b/check_newest_file_age.sh index ccea7e00cf37176919aa74bbe2f1b71f2e67095f..04b39d118de1d95e4d910203432bcfb82a858f30 100755 --- a/check_newest_file_age.sh +++ b/check_newest_file_age.sh @@ -252,7 +252,7 @@ esac DIR_COUNT=0 OK_FILE_COUNT=0 OUTPUT= -CURRENT_TIME=`date +%s` +CURRENT_TIME=`date --utc +%s` OS_DISTRO=`uname -s` # Loop through each provided directory. diff --git a/check_odoo2_storage.sh b/check_odoo2_storage.sh index 658c36fd8b33c5bb1ddd1b2c0f9db8a7263320d3..24f906d84dd3584d4af121d8257a1e203245aa7f 100755 --- a/check_odoo2_storage.sh +++ b/check_odoo2_storage.sh @@ -16,7 +16,7 @@ do OBJECTS=$(grep "Objects:" $file | cut -d ":" -f 2 | tr -d " ") LAST_FULL_BACKUP=$(grep full-signature $file | tail -1) LAST_INC_BACKUP=$(grep new-signature $file | tail -1) - if ([ -n "$LAST_FULL_BACKUP" ] && [ `date -d "${LAST_FULL_BACKUP:5:19}" +%s` -gt `date -d '1 day ago' +%s` ]) || ([ -n "$LAST_INC_BACKUP" ] && [ `date -d "${LAST_INC_BACKUP:5:19}" +%s` -gt `date -d '1 day ago' +%s` ]) + if ([ -n "$LAST_FULL_BACKUP" ] && [ `date --utc --date "${LAST_FULL_BACKUP:5:19}" +%s` -gt `date --utc --date '1 day ago' +%s` ]) || ([ -n "$LAST_INC_BACKUP" ] && [ `date --utc --date "${LAST_INC_BACKUP:5:19}" +%s` -gt `date --utc --date '1 day ago' +%s` ]) then OUTPUT+="OK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Full-Backup: ${LAST_FULL_BACKUP:5:19}, Last-Incremental-Backup: ${LAST_INC_BACKUP:5:19}\n" else diff --git a/check_odoo_storage.sh b/check_odoo_storage.sh index b7150d09c169557643724ac986bfb704ea7504c7..0203529525797457a317fa44faf94cedbe1fce16 100755 --- a/check_odoo_storage.sh +++ b/check_odoo_storage.sh @@ -16,7 +16,7 @@ do OBJECTS=$(grep "Objects:" $file | cut -d ":" -f 2 | tr -d " ") LAST_FULL_BACKUP=$(grep full-signature $file | tail -1) LAST_INC_BACKUP=$(grep new-signature $file | tail -1) - if ([ -n "$LAST_FULL_BACKUP" ] && [ `date -d "${LAST_FULL_BACKUP:5:19}" +%s` -gt `date -d '1 day ago' +%s` ]) || ([ -n "$LAST_INC_BACKUP" ] && [ `date -d "${LAST_INC_BACKUP:5:19}" +%s` -gt `date -d '1 day ago' +%s` ]) + if ([ -n "$LAST_FULL_BACKUP" ] && [ `date --utc --date "${LAST_FULL_BACKUP:5:19}" +%s` -gt `date --utc --date '1 day ago' +%s` ]) || ([ -n "$LAST_INC_BACKUP" ] && [ `date --utc --date "${LAST_INC_BACKUP:5:19}" +%s` -gt `date --utc --date '1 day ago' +%s` ]) then OUTPUT+="OK: Container: $CONTAINER, Size: $BYTES, # Files: $OBJECTS, Last-Full-Backup: ${LAST_FULL_BACKUP:5:19}, Last-Incremental-Backup: ${LAST_INC_BACKUP:5:19}\n" else