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”

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

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

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: