Any way to register application with systemd watchdog at runtime ? I mean don't use systemd unit file, via systemd API for example
Linux watchdog is used for system reset only ? Can it be used for application reset ?
Systemd's watchdog can be mainly used for 3 different actions:
RuntimeWatchdogSec=
option in /etc/systemd/system.conf
example unit file:
[Unit]
Description=My Little Daemon
Documentation=man:mylittled(8)
[Service]
ExecStart=/usr/bin/mylittled
WatchdogSec=30s
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
StartLimitAction=reboot-force
The example is taken from: http://0pointer.de/blog/projects/watchdog.html, which gives a pretty complete overview of what and how you can use the watchdog service.
The Linux watchdog daemon should be used for system reset jobs, though it can also run a "repair binary" on persistent errors that could be used to fix or restart a process. Generally speaking, to monitor daemon processes and restart them you should use the init/upstart/systemd supported methods as already answered and keep the watchdog operation for the most serious "only a reboot is likely to fix things" situations.
You have multiple questions or expectations in your question.
When it comes to the Linux service watchdog it is intended to detect system (OS, Linux) issues (broken, frozen, ...) and it works in the following way:
On the other hand, there is an interest in watching an application/service health.
systemd
mechanism) or