Skip to content

Instantly share code, notes, and snippets.

@ianling
Last active April 14, 2016 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianling/df4eb614ce02c34c58f901c9b1b07568 to your computer and use it in GitHub Desktop.
Save ianling/df4eb614ce02c34c58f901c9b1b07568 to your computer and use it in GitHub Desktop.
Bash script that checks each Let's Encrypt cert to make sure it won't expire soon
#!/bin/bash
for cert in `find /etc/letsencrypt/live -name 'cert.pem'` ; do
certpath=`/usr/bin/dirname $cert`
website=`basename $certpath`
if /usr/bin/openssl x509 -checkend 2592000 -noout -in $cert ; then
echo "Cert for $website is good"
else
echo "**Cert for $website is bad**"
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment