Skip to content

Instantly share code, notes, and snippets.

@JiapengLi
Forked from dbirks/certbot-systemd-ubuntu.md
Created August 24, 2020 07:35
Show Gist options
  • Select an option

  • Save JiapengLi/d3443c11598710bcb3cac956090471c3 to your computer and use it in GitHub Desktop.

Select an option

Save JiapengLi/d3443c11598710bcb3cac956090471c3 to your computer and use it in GitHub Desktop.
Certbot renew with a systemd timer on Ubuntu

Ubuntu 16.04

/etc/systemd/system/certbot.service

[Unit]
Description=Let's Encrypt renewal

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos
ExecStartPost=/bin/systemctl reload apache2.service

/etc/systemd/system/certbot.timer

[Unit]
Description=Twice daily renewal of Let's Encrypt's certificates

[Timer]
OnCalendar=0/12:00:00
RandomizedDelaySec=1h
Persistent=true

[Install]
WantedBy=timers.target

Enable and start certbot.timer

systemctl enable --now certbot.timer

Modified from: https://wiki.archlinux.org/index.php/Let%E2%80%99s_Encrypt#systemd

@JiapengLi
Copy link
Copy Markdown
Author

Don't forget to create script under /etc/letsencrypt/renewal-hooks/post/ to valid the renew cert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment