From 5d23ed49d9c41b013a8f93ed09ab68483b48f037 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 7 Jul 2023 08:57:52 +0200 Subject: use $DATE instead of date --- crypt-expiry-check.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crypt-expiry-check.in') 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 -- cgit v1.2.3-54-g00ecf