How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

December 8, 2017

centos 7 systemctl restart httpd or other service take long time

Filed under: Linux — Tags: , , , — admin @ 12:47 pm

Well on centos 7 I notice that when I run systemctl restart httpd sometime take a lot of time  to restart it .

After some search I found out that there is a TimeoutStopSec variable that do something like this

“Configures the time to wait for stop. If a service is asked to stop, but does not terminate in the specified time, it will be terminated forcibly via SIGTERM, and after another timeout of equal duration with SIGKILL (see KillMode= in systemd.kill(5)). Takes a unit-less value in seconds, or a time span value such as “5min 20s”. Pass “infinity” to disable the timeout logic. Defaults to DefaultTimeoutStopSec= from the manager configuration file”

So I modify the

/usr/lib/systemd/system/httpd.service and added the

TimeoutStopSec=5

Into it

You need to run systemctl daemon-reload after modify that file

[Service]

TimeoutStopSec=5

Powered by WordPress