Run command with systemd periodically

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.