externalscripts/certificate_expiration-file-bsd
author Tomas Zeman <tzeman@volny.cz>
Wed, 07 Nov 2018 08:41:06 +0100
changeset 37 968d93e43326
parent 30 externalscripts/certificate_expiration-bsd@79eef9a447de
permissions -rwxr-xr-x
externalscripts/certificate_expiration-file-bsd

#!/bin/sh

openssl x509 -in $1 -enddate -noout | grep notAfter| awk -F= '{print $2}' | \
while read l; do
	t=`date -j -f "%b %d %T %Y %Z" "$l" +%s`
	n=`date +%s`
	echo `expr $t - $n`
done