Search code examples
linuxservicesystemd

Systemd service with multiple execStart and watchdog for each execStart


I would know if it's possible to create service with multiple execStart where I can monitor each execStart with a watchdog such as:

[Unit]
Description="test service"

[Service]
Type=oneshot
ExecStart=/home/program1
ExecStart=/home/program2
WatchdogSec= 2
Restart=on-failure
RestartSec= 1


[Install]
WantedBy=default.target

Or it's better if I use template service for example [email protected] with this syntax:

[Unit]
Description="test service %i"

[Service]
ExecStart=/home/%i
WatchdogSec= 2
Restart=on-failure
RestartSec= 1

[Install]
WantedBy=default.target

Thanks in advance.


Solution

  • I found that using the template service is the better solution and covers what I need. Thanks to you all.