Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the systemd timeout in centos

The default start timeout for systemd is 90s. I want to change it to 300s. So I change the DefaultTimeoutStartSec in /etc/systemd/system.conf

# vi /etc/systemd/system.conf
DefaultTimeoutStartSec=90s

But how can I make systemd reload the /etc/systemd/system.conf? If only change the file, the timeout does not change.

# systemctl show service -p TimeoutStartUSec
TimeoutStartUSec=1min 30s
like image 294
firelyu Avatar asked Nov 18 '15 10:11

firelyu


2 Answers

systemctl daemon-reexec should solve your problem.

like image 116
CertDepot Avatar answered Oct 02 '22 12:10

CertDepot


there are only a few properties that you can set thru "set-property" command.

you can get a version of your systemd thru command:

systemctl --version

then you need to update it to get latest commands like "cat" with:

sudo yum update systemd -y

after that you can see stuff that overrides your DefaultTimeoutStartSec=90s run:

systemctl cat <service>

Then you need to create a {service}.service file to override your settings with information from [Service] section from systemctl cat {service} command and restart daemon after that:

echo "[Service]
TimeoutSec=15min
ExecStart=/etc/rc.d/init.d/<service> start
ExecStop=/etc/rc.d/init.d/<service> stop
ExecReload=/etc/rc.d/init.d/<service> reload" > /lib/systemd/system/{service}.service

sudo systemctl daemon-reload
like image 31
Johnny Cage Avatar answered Oct 02 '22 10:10

Johnny Cage