Terminate a python script from linux shell / bash script

Larry Bates larry.bates at websafe.com`
Thu Jul 10 02:25:22 CEST 2008


Gros Bedo wrote:
> Hello :-)
> 
> I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely. The problem is that when I uninstall it, my program keeps running in the background, even if the files are deleted.
> 
> I know I can terminate python shell directly, but this is not a good idea because the end-user may be working with another important python application, and would be very angry if mine would close everything that is using python shell.
> 
> So, is there a way from the Linux shell or a bash script to terminate just one specific Python script ?
> _________________________________________________________________
> Votre contact a choisi Hotmail, l'e-mail nouvelle génération. Créez un compte. 
> http://www.windowslive.fr/hotmail/default.asp

You should use the signal module to look for SIGINT signal and exit if it is 
received.

-Larry



More information about the Python-list mailing list