Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
linux:debian:systemd-command-periodically [2024/12/25 14:08] – removed - external edit (Unknown date) 127.0.0.1 | linux:debian:systemd-command-periodically [2024/12/25 14:08] (current) – ↷ Page moved from linux:linux-tutorials:systemd-command-periodically to linux:debian:systemd-command-periodically Zyzonix | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Run command with systemd periodically ===== | ||
+ | |||
+ | If you wish to run a command periodically with '' | ||
+ | <code bash> | ||
+ | [Unit] | ||
+ | Description=Autorun command | ||
+ | After=network.target network-online.target | ||
+ | |||
+ | [Service] | ||
+ | RestartSec=30 | ||
+ | Restart=always | ||
+ | User=< | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | Edit '' | ||
+ | |||
+ | === Restart service automatically after a pre-defined interval === | ||
+ | Therefore add the following line to the '' | ||
+ | |||
+ | <code bash> | ||
+ | RuntimeMaxSec=180s | ||
+ | </ | ||
+ | |||
+ | **It's required that '' | ||
+ | Adjust the runtime-interval by changing the '' | ||