Home > bash, python > Difference between SIGTERM and SIGKILL

Difference between SIGTERM and SIGKILL

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.

About these ads
Categories: bash, python Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: