Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created September 9, 2019 06:14
Show Gist options
  • Save Bouni/e0284a3a8567d5382a190521463a150c to your computer and use it in GitHub Desktop.
Save Bouni/e0284a3a8567d5382a190521463a150c to your computer and use it in GitHub Desktop.
Systemd LetsEncrypt timer for cert renewal
[Unit]
Description=Certbot certificate renewal
[Service]
ExecStart=/usr/bin/certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"
ExecStartPost=/usr/bin/systemctl restart nginx
[Unit]
Description=Timer for Certbot certificate renewal
[Timer]
OnBootSec=300
OnUnitActiveSec=1w
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment