[systemd-devel] Behavior of RestartSec= & Restart= parameters

Tiwari, Hari Sahaya hari-sahaya.tiwari at hpe.com
Sat Apr 11 19:51:40 UTC 2020


Hi,

I had a query on RestartSec= & Restart= parameters and how they work with StartLimitInterval= & StartLimitBurst= parameters.

I have a socket-service pair (say test.socket & test.service)

test.socket
[Unit]
Description=Test socket

[Socket]
ListenDatagram=123
Accept=No

[Install]
WantedBy=sockets.target

test.service
[Unit]
Description=test service
Requires=test.socket

[Service]
Type=simple
ExecStart=/bin/mytest
StandardInput=socket

[Install]
WantedBy=multi-user.target


I see that the test.socket fails with following error,
systemd[1]: test.service: Start request repeated too quickly.
systemd[1]: test.service: Failed with result 'exit-code'.
systemd[1]: Failed to start test service.
systemd[1]: test.socket: Failed with result 'service-start-limit-hit'.

The test.socket fails after trying to start test.service for 5 times.
I think this this is due to the default values of StartLimitInterval= & StartLimitBurst= which are 10sec and 5 respectively.
The test.service restart is attempted even though there is no "Restart=" parameter is specified in the file.
So, this means StartLimitInterval= & StartLimitBurst= are not dependent on "Restart=" parameter? Is my understanding correct ?

Is there a way to add a delay before attempting to restart the service without specifying "Restart=" parameter?
As per my understanding "RestartSec=" works only when "Restart=" parameter is set to some value.

Thanks & Regards,
Hari.





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200411/c7638d2d/attachment.htm>


More information about the systemd-devel mailing list