Reducing shutdown timeout for "a stop job is running"

/etc/systemd/system.conf has a line

#DefaultTimeoutStopSec=90s

which can be uncommented and changed


How do I reduce the timeout from 5 minutes to, say, 15 seconds or so?

You re-build systemd from source, patching the hardwired timeout in systemv-sysv-generator from TimeoutSec=5min to whatever you want. Or you ask the systemd people for a control knob somewhere in the Fedora/SUSE or LSB headers.

Or, on the gripping hand, you give up on using this rc script that you have and write a systemd service unit for your service, whose timeouts you can set with an explicit TimeoutSec= setting, installed with a drop-in settings file in /etc/systemd/system/pm2.service.d/timeout.conf if necessary.

Given this, this, this, this, this, and others, the first rule for migrating to systemd applies here as well.

Further reading

  • https://unix.stackexchange.com/a/316369/5132
  • https://unix.stackexchange.com/a/233581/5132
  • https://unix.stackexchange.com/a/326354/5132
  • https://unix.stackexchange.com/a/316168/5132
  • https://askubuntu.com/a/626858/43344
  • Jonathan de Boyne Pollard (2015). The systemd House of Horror. Frequently Given Answers.