将 systemd.service TimeoutSec 值更改为“无穷大”没有任何效果

将 systemd.service TimeoutSec 值更改为“无穷大”没有任何效果

我的 app.service 文件的 [Service] 部分如下:-

[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

之后我安装了该应用程序,并且该文件已正确复制到/usr/lib/systemd/system/app.service.

我跑了systemctl daemon-reload,但是好像对启动时间没有影响!它在我运行时失败systemctl start appsystemctl reload app.service出现以下错误:-

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

的输出systemctl status app是:-

● 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.

我注意到的另一件奇怪的事情是当我跑步时systemctl show app.service -p TimeoutSec,我没有得到任何结果;是空白的吗?

我尝试过做一个systemctl reboot,但仍然没有骰子。

当然,当我将值更改为其他值(例如 )时TimeoutSec=5min,它就可以正常工作。但我确实需要这个应用程序来占用无穷大。

我哪里错了?

答案1

如果您使用的 systemd 版本早于 229,则可能需要使用 0 而不是无穷大来禁用超时。

相关内容