doc: add systemd timer and service example

This commit is contained in:
Sebastian Mark 2024-09-01 20:16:09 +02:00
parent 421e33e874
commit a2d4a65466

View file

@ -26,6 +26,42 @@ Recommended crontab usage:
(do not forget logrotate)
### Systemd
Recommended systemd usage:
```toml
# /etc/systemd/system/dc-ops.service
[Unit]
Description=Run dc-ops once
After=docker.target
[Service]
Type=simple
WorkingDirectory=/opt/dc-ops/
ExecStart=python3 dc-ops
```
```toml
# /etc/systemd/system/dc-ops.timer
[Unit]
Description=Start dc-ops service periodically
[Timer]
Persistent=true
OnCalendar=*:0/15
Unit=dc-ops.service
[Install]
WantedBy=timers.target
```
Enable and start the timer:
```
systemctl enable dc-ops.timer
systemctl start dc-ops.timer
```
## Parameters
See `dc-ops --help`