Set Restart-Timeout for Apache2

Post Reply
User avatar
Site Admin
Posts: 936
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Sometimes, when the server load is high, if an script tries to restart Apache, it may happen that Apache does not restart at all, but remains shut down, because due to the excessive server load, the restart process can take an unexpectedly long time, after which systemctl simply gives up reboot.
To prevent this, we need to set the Apache TimeOutStart to a high value.

Code: Select all

sed -i "s|Restart=on-abort|Restart=on-abort\nTimeoutStartSec=900|g" /lib/systemd/system/apache2.service
cat /lib/systemd/system/apache2.service
systemctl daemon-reload
systemctl restart apache2

Post Reply