Skip to content

Instantly share code, notes, and snippets.

@qubbit
Created April 6, 2018 04:24
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 qubbit/e782b248a58df18afdb1c8cc08269111 to your computer and use it in GitHub Desktop.
Save qubbit/e782b248a58df18afdb1c8cc08269111 to your computer and use it in GitHub Desktop.
Automatic Let's Encrypt Renewal
#!/usr/bin/env bash
RENEWAL_STATUS=$(certbot-auto certonly \
-d 'domain.com,sub.domain.com' \
--nginx \
-n \
--expand
)
curl -s --user 'api:key-MAILGUN_API_KEY' \
https://api.mailgun.net/v3/domain.com/messages \
-F from='Snow White <user@domain.com>' \
-F to=user@gmail.com \
-F subject='SSL Certificates Renewed!' \
-F text="$RENEWAL_STATUS"
# mv renew_certs.sh /etc/cron.monthly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment