How to change the systemd timeout in centos

13,210

Solution 1

systemctl daemon-reexec should solve your problem.

Solution 2

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
Share:
13,210
firelyu
Author by

firelyu

Updated on July 13, 2022

Comments

  • firelyu
    firelyu over 1 year

    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