Sid Sahay
Sid Sahay

Reputation: 518

Changing systemd.service TimeoutSec value to “infinity” has no effect

My app.service file's [Service] part is the following:-

[Service]
Type=forking
Restart=no
IgnoreSIGPIPE=no
GuessMainPID=no
ExecStart=/opt/app/appl_init.d start
ExecStop=/opt/app/appl_init.d stop
TimeoutSec=infinity

After which I installed the app, and the file is correctly copied to /usr/lib/systemd/system/app.service.

I have run systemctl daemon-reload, but it seems to have no effect on the start up time! It fails just as I run systemctl start app or systemctl reload app.service with the following error:-

Job for app.service failed because a fatal signal was delivered to the control process. See "systemctl status app.service" and "journalctl -xe" for details

Output of systemctl status app is:-

● app.service - ApplicationTest
   Loaded: loaded (/opt/app/appl_init.d; enabled; vendor preset: disabled)
   Active: failed (Result: signal) since Tue 2017-03-21 01:55:22 EDT; 1min 4s ago
     Docs: man:app(8)
  Process: 4126 ExecStart=/opt/app/appl_init.d start (code=killed, signal=KILL)

Mar 21 01:55:22 centosvm systemd[1]: Starting ApplicationTest...
Mar 21 01:55:22 centosvm systemd[1]: app.service start operation timed out. Terminating.
Mar 21 01:55:22 centosvm systemd[1]: app.service stop-final-sigterm timed out. Killing.
Mar 21 01:55:22 centosvm systemd[1]: app.service: control process exited, code=killed status=9
Mar 21 01:55:22 centosvm systemd[1]: Failed to start ApplicationTest.
Mar 21 01:55:22 centosvm systemd[1]: Unit app.service entered failed state.
Mar 21 01:55:22 centosvm systemd[1]: app.service failed.

Another queer thing that I noticed is when I run systemctl show app.service -p TimeoutSec, I don't get any result; it's blank?

I have tried doing a systemctl reboot, but still, no dice.

Of course, when I change the value to anything else like TimeoutSec=5min, then it works perfectly fine. But I really need this application to take up infinity.

Where am I going wrong?

Upvotes: 6

Views: 12335

Answers (1)

Sid Sahay
Sid Sahay

Reputation: 518

TimeoutSec=0 fixed the problem.

Apparently, if you are using a version of systemd older than 229, you will need to use 0 instead of infinity to disable the timeout.

Upvotes: 10

Related Questions