I have a simple
systemd service unit to restart my
python script on unconditional exits so defined
Restart=always in the service definition. I just want to absolutely make sure even if the script hangs in some way, I can restart it by enabling the
WatchdogSec= variable in the unit file.
My problem is the official docs for systemd's journal does not explain it clearly.
Quoting from the same page,
Configures the watchdog timeout for a service. The watchdog is activated when the start-up is completed. The service must call
"WATCHDOG=1"(i.e. the "keep-alive ping").
The part that is unclear is, will the service itself take care of maintaining the pings with the watchdog service (or) the application it is running (in my case - Python script) needs to maintain the ping by updating the environment variable mentioned.
My simple service definition
[Unit] Description=dev-Status: Computes RF device availability status [Service] Type=simple EnvironmentFile=/etc/sysconfig/db_EndPoint ExecStart=/usr/bin/python /opt/foobar/foobar.py RestartSec=10 Restart=always [Install] WantedBy=default.target
So to this service file if I just add the below line, would it restart my script automatically?