doc: add systemd timer and service example
This commit is contained in:
parent
421e33e874
commit
a2d4a65466
1 changed files with 36 additions and 0 deletions
36
README.md
36
README.md
|
@ -26,6 +26,42 @@ Recommended crontab usage:
|
||||||
|
|
||||||
(do not forget logrotate)
|
(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
|
## Parameters
|
||||||
|
|
||||||
See `dc-ops --help`
|
See `dc-ops --help`
|
||||||
|
|
Loading…
Reference in a new issue