If you wish to run a command periodically with systemd create a service with the following content:

[Unit]
Description=Autorun command
After=network.target network-online.target
 
[Service]
RestartSec=30
Restart=always
User=<user>
ExecStart=/command/to/be/run
 
[Install]
WantedBy=multi-user.target

Edit RestartSec for the time (in seconds) between each run.

  • linux/linux-tutorials/systemd-command-periodically.txt
  • Last modified: 2024/04/03 16:06
  • by Zyzonix