Archive

Posts Tagged ‘SIGKILL’

Difference between SIGTERM and SIGKILL

January 10, 2012 Leave a comment

Major Hayden has a nice post on SIGTERM and SIGKILL.

Here I sum it up. When you execute “kill 123“, it sends a SIGTERM signal to process 123. In this case the process has a chance to clean up (e.g. free resources) before exiting. The brutal “kill -9 123” sends a SIGKILL signal and terminates the process immediately, i.e. no time for cleaning up. Be nice and first try SIGTERM.

In Python, you can kill a process the following way:

import os
import signal

os.kill(pid, signal.SIGTERM)

Geek rap “kill -9″

 
Note
At the Racker Hacker blog you can find several posts related to server administration.

Categories: bash, python Tags: , ,
Follow

Get every new post delivered to your Inbox.

Join 42 other followers