diff options
author | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2023-07-07 08:57:52 +0200 |
---|---|---|
committer | Erich Eckner <erich.eckner.ext@bestsecret.com> | 2023-07-07 08:57:52 +0200 |
commit | 5d23ed49d9c41b013a8f93ed09ab68483b48f037 (patch) | |
tree | 63b94c1a972590922d2914cdb6a6afbfdc25eb2c /crypt-expiry-check.in | |
parent | 3aab2bddfa62452c6bf70d01cfa17374e0545dec (diff) | |
download | crypt-expiry-check-5d23ed49d9c41b013a8f93ed09ab68483b48f037.tar.xz |
use $DATE instead of date
Diffstat (limited to 'crypt-expiry-check.in')
-rwxr-xr-x | crypt-expiry-check.in | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypt-expiry-check.in b/crypt-expiry-check.in index 624d801..f81a9fd 100755 --- a/crypt-expiry-check.in +++ b/crypt-expiry-check.in @@ -410,7 +410,7 @@ check_file_status() { # Extract the expiration date from the certificate CERTDATE=$(${OPENSSL} x509 -in ${CERT_TMP} -enddate -noout | \ ${SED} 's/notAfter\=//') - CERTDATE=$(date +%s -d "${CERTDATE}") + CERTDATE=$(${DATE} +%s -d "${CERTDATE}") # Extract the issuer from the certificate CERTISSUER=$(${OPENSSL} x509 -in ${CERT_TMP} -issuer -noout | \ @@ -429,7 +429,7 @@ check_file_status() { # Extract the expiration date from the ceriticate CERTDATE=$(while ${OPENSSL} x509 -enddate -noout -inform ${CERTTYPE} 2>/dev/null; do :; done <${CERTFILE} | \ ${SED} 's/notAfter\=//' | \ - xargs -rI __ date +%s -d "__") + xargs -rI __ ${DATE} +%s -d "__") # Extract the issuer from the certificate CERTISSUER=$(${OPENSSL} x509 -in ${CERTFILE} -issuer -noout -inform ${CERTTYPE} | \ @@ -445,7 +445,7 @@ check_file_status() { fi # Convert the date to seconds, and get the diff between NOW and the expiration date - CERTDIFF=$[${CERTDATE} - $(date +%s)] + CERTDIFF=$[${CERTDATE} - $(${DATE} +%s)] if [ ${CERTDIFF} -lt 0 ] then CERTDIFF=$[$[${CERTDIFF}+1]/3600/24-1] @@ -505,10 +505,10 @@ check_gpg_key_status() { echo "No valid gpg-key found for ${GPG_ADDRESS}." | ${TEE} -a ${MAILOUT_TMP} >> ${STDOUT_TMP} set_retcode 2 else - KEY_DATE=$(date +%s -ud "${KEY_DATE_STR}") + KEY_DATE=$(${DATE} +%s -ud "${KEY_DATE_STR}") fi - KEY_DIFF=$[${KEY_DATE} - $(date +%s)] + KEY_DIFF=$[${KEY_DATE} - $(${DATE} +%s)] if [ ${KEY_DIFF} -lt 0 ] then KEY_DIFF=$[$[${KEY_DIFF}+1]/3600/24-1] @@ -758,7 +758,7 @@ then ( echo "To: ${ADMIN}" echo "From: $(whoami)@$(hostname)" - echo "Subject: $(basename $0) at $(date)" + echo "Subject: $(basename $0) at $(${DATE})" echo "" cat ${MAILOUT_TMP} ) | ${MAIL} -t |