I have an application that regularly sends sd_notify
signals to the Service Manager that it is running.
I found the myapp.service
file currently residing at:
/usr/lib/systemd/system/myapp.service
It has the WatchdogSec
line commented out currently:
Type=simple
WorkingDirectory=/usr/share/java/mycom/myapp/
ExecStart=/usr/bin/java myapp.jar
SyslogIdentifier=myapp
StandardOutput=syslog
StandardError=syslog
SuccessExitStatus=143
#WatchdogSec=600
Restart=on-failure
RestartSec=10
Can I simply remove the hashtag, restart the service and expect the Service Manager to restart the service within 10 minutes if it gets terminated?
Yes it will work, the sd_notify is sent to inform Systemd that it's still running.
The line WatchdogSec=
indicates the max time (in seconds) acceptable without any new sd_notify from your program. After 600 seconds, it will consider him as failed, fire the on-failure
and restart him.