mirror of
https://github.com/acmesh-official/acme.sh
synced 2025-09-02 15:25:26 +00:00
Created Using systemd units instead of cron (markdown)
37
Using-systemd-units-instead-of-cron.md
Normal file
37
Using-systemd-units-instead-of-cron.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
**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
|
||||||
|
ExecStart=/path/to/acme.sh <your acme.sh arguments here>
|
||||||
|
```
|
||||||
|
|
||||||
|
**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 enable acme_letsencrypt.timer`
|
Reference in New Issue
Block a user