Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've noticed that with Fedora 17, a shutdown operation (e.g., shutdown -h now) has gotten so much faster (feels like 2 seconds max). So I'm wondering if running processes are terminated properly? Especially on Fedora (again, about 2 seconds), I can hardly imagine that every process has enough time to finish.

I'm assuming every user process has been closed by the user (manually) before the shutdown command is issued, so only system services are left (still, those may have stuff to do on exit too).

So I wrote a tiny little program which catches most signals and, if a number (of seconds) is provided, it'll wait before exiting. Other than that, it doesn't do anything. Then - first on a Debian system - I started it with a delay of 60 seconds. When it received a SIGHUP (I'm assuming its parent shell has been terminated), it started the 60 second countdown. After 10 seconds, it received a friendly SIGTERM. My program ignored this signal and continued the countdown - until second 40 when it tragically died. So 20 seconds after it was told to terminate (SIGHUP), it was SIGKILLed.

Now the same test on Fedora 17 (3.5.3-1.fc17.x86_64):

Caught signal 1.
Runtime: 8 second(s)
Delaying termination for 60 second(s)...
Caught signal 15 - ignoring!

Not even one second after the SIGHUP, it receives the SIGTERM. A programmer may delay the termination of his program after a SIGTERM, in order to finish jobs, save settings and so on (unlike, maybe after a SIGINT). My program gets 2 seconds before it's killed.

What if a running process is killed while saving some settings (corrupted settings file?) or some kind of daemon (e.g., some file server) is writing cached data to disk (corrupted data?)?

share|improve this question
up vote 1 down vote accepted

Services can specify how they want to be terminated in their *.service file. You can select any timeout you want, you don't have to live with the default. If you have postgreSQL or mysqld installed, look at their service files to see how they arrange a clean shutdown.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .