Skip to content

Instantly share code, notes, and snippets.

@swipswaps
Forked from ajaegers/certbot-renew
Created December 2, 2021 23:11
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 swipswaps/7ebfca2114a0aa0b58aff83eac0f91cf to your computer and use it in GitHub Desktop.
Save swipswaps/7ebfca2114a0aa0b58aff83eac0f91cf to your computer and use it in GitHub Desktop.
Simple Certbot (Let's Encrypt) script for auto-renewal certificates
# Put this file in folder /etc/cron.d/
MAILTO="debug@example.com"
0 1 * * * root /usr/local/sbin/certbot-renew.sh
#!/bin/bash
#
# Supposing you have /etc/letsencrypt/cli.ini config file with domains
#
# Put this script in a daily cron and your cert will be automagically updated 30 days before expiration.
# If renew doesn't succeed, you'll receive email notification from your CA.
#
# https://certbot.eff.org/docs/using.html#renewal
#
sudo certbot-auto renew --noninteractive --post-hook "service apache2 reload"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment