-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Using systemd units instead of cron
Riley Avron edited this page Sep 6, 2020
·
14 revisions
1. Create a systemd unit for acme.sh:
/etc/systemd/system/acme_letsencrypt.service
[Unit]
Description=Renew Let's Encrypt certificates using acme.sh
After=network-online.target
[Service]
Type=oneshot
# --home's argument should be where the acme.sh script resides.
ExecStart=/path/to/acme.sh --home /path/to <your acme.sh arguments here>
# acme.sh returns 2 when renewal is skipped (i.e. certs up to date)
SuccessExitStatus=0 2
2. Test that it works before creating the timer:
sudo systemctl daemon-reload
sudo systemctl start acme_letsencrypt --now
3. Create systemd timer unit for the service above:
/etc/systemd/system/acme_letsencrypt.timer
[Unit]
Description=Daily renewal of Let's Encrypt's certificates
[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.target
4. Enable timer:
sudo systemctl start acme_letsencrypt.timer
sudo systemctl enable acme_letsencrypt.timer
Buy me a beer, Donate to acme.sh if it saves your time. Your donation makes acme.sh better: https://donate.acme.sh/
如果 acme.sh 帮你节省了时间,请考虑赏我一杯啤酒🍺, 捐助: https://donate.acme.sh/ 你的支持将会使得 acme.sh 越来越好. 感谢