Last active
September 6, 2019 23:26
-
-
Save bmatthewshea/136706f357f5c818e62d0500d5f7e783 to your computer and use it in GitHub Desktop.
Certbot renewal for standalone certificates. Run a script instead of 'certbot renew -q', only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Brady Shea - 06SEP2019 | |
# | |
# Alternative certbot.service file for use on standalone. | |
# If you use the apache2.service (or another webserver) please adjust. | |
# | |
# This will be run as root from systemd.timer/service. | |
# Verify '/lib/systemd/system/certbot.service' calls this script. | |
# | |
test -x /usr/bin/certbot && \ | |
systemctl stop nginx.service && \ | |
sleep 10; \ | |
/usr/bin/certbot -q renew && \ | |
sleep 10; \ | |
systemctl start nginx.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Certbot | |
Documentation=file:///usr/share/doc/python-certbot-doc/html/index.html | |
Documentation=https://letsencrypt.readthedocs.io/en/latest/ | |
[Service] | |
Type=oneshot | |
ExecStart=/home/ubuntu/scripts/certbot-renew.sh | |
PrivateTmp=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps:
/lib/systemd/system/certbot.service
(see revision of .service file above for the only change/difference)Here is mine:
sudo chmod 760 certbot-renew.sh && sudo chown root:ubuntu certbot-renew.sh
Then:
ls -la ~/scripts/certbot-renew.sh
Should show:
-rwxrw---- 1 root ubuntu 442 Sep 6 22:59 /home/ubuntu/scripts/certbot-renew.sh
Permissions set. Good to go..