Feb 202016

OK, my Linux friends… try not to make the mistake that I made earlier tonight.

I was trying to stop a process in the gentlest way possible, buy sending it a hangup signal to its numerical process ID, e.g., 12345. The syntax was supposed to be this:

kill -1 12345

Unfortunately this is not what I typed. Because it was an afterthought that I’d use a hangup signal (instead of the default kill signal) I entered the option after the process ID, like this:

kill 12345 -1

A second or two later, I lost my xterm session. In fact, I lost all my xterm sessions. My mail client disconnected. I could not even telnet into the server anymore. For all practical intents and purposes, it seemed dead as a doorknob.

OK, not completely dead. I was able to log back in through its physical keyboard, only to find out that apart from core processes, nothing was running. No SQL server. No Web server. No SSH demon. No name server. And so on.

What the !#@@#@!& have I done?

I looked at the command long and saw the last command that I typed. I quickly checked the man page of kill and indeed… what I typed instructed kill to terminate process 12345 (using the default kill signal) and then, using the same default kill signal, terminate all processes with a pid greater than 1.

Bravo. What a clever boy. I promise I’ll try not to do that again anytime soon.

Still, I was able to bring everything back to life without rebooting the server. I hate reboots.

 Posted by at 10:49 pm

  One Response to “kill [pid] -1”

  1. […] night, when I almost managed to kill my server, I was playing with a service that I just discovered: Weather forecast in […]