Skip to content

Instantly share code, notes, and snippets.

@stefanotorresi
Last active March 4, 2016 20:38
Show Gist options
  • Save stefanotorresi/1650c3e9708892c30fdb to your computer and use it in GitHub Desktop.
Save stefanotorresi/1650c3e9708892c30fdb to your computer and use it in GitHub Desktop.
Let's Encrypt renewal cron job
#!/usr/bin/env bash
if ! /opt/letsencrypt/letsencrypt-auto renew > /var/log/letsencrypt/renew.log 2>&1 ; then
echo "Automated renewal failed:"
cat /var/log/letsencrypt/renew.log
exit 1
fi
if [[ "$(tail -1 /var/log/letsencrypt/renew.log)" != 'No renewals were attempted.' ]]; then
service apache2 restart 1> /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment