Terminate a python script from linux shell / bash script

MRAB google at mrabarnett.plus.com
Wed Jul 9 23:43:17 EDT 2008


On Jul 10, 1:25 am, Larry Bates <larry.ba... at websafe.com`> wrote:
> 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.
>
An alternative, though crude, hack is for the script to check for the
existence (or non-existence) of a special file and quit if found (or
not found). It could also create it when it starts or delete it when
it quits, as appropriate.



More information about the Python-list mailing list