Centos
將 systemd.service TimeoutSec 值更改為“infinity”無效
我的 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 app
或systemctl 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
,它都可以正常工作。但我真的需要這個應用程序來佔用無窮大。我哪裡錯了?
如果您使用的 systemd 版本早於 229,您可能需要使用 0 而不是 infinity 來禁用超時。