By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,214 Members | 2,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,214 IT Pros & Developers. It's quick & easy.

Terminate a python script from linux shell / bash script

P: n/a

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 ideabecause the end-user may be working with another important python application, and would be very angry if mine would close everything that is usingpython 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éezun compte.
http://www.windowslive.fr/hotmail/default.asp
Jul 9 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
Jul 10 '08 #2

P: n/a
On Jul 10, 1:25*am, Larry Bates <larry.ba...@websafe.com`wrote:
Gros Bedo wrote:
Hello :-)
I have a question about Python and Linux shell. I have a python programwhich 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 usingpython 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 itis
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.
Jul 10 '08 #3

P: n/a
>>>>Gros Bedo <gr*******@hotmail.com(GB) wrote:
>GBI have a question about Python and Linux shell. I have a python
GBprogram which is permanently resident in the end-user system. I'm
GBcurrently producing a RPM package, and it works nicely. The problem is
GBthat when I uninstall it, my program keeps running in the background,
GBeven if the files are deleted.
>GBI know I can terminate python shell directly, but this is not a good
GBidea because the end-user may be working with another important python
GBapplication, and would be very angry if mine would close everything
GBthat is using python shell.
That's not how it works. If you kill one running python script it will not
effect other python scripts. Each script has its own interpreter process
running.
>GBSo, is there a way from the Linux shell or a bash script to terminate
GBjust one specific Python script ?
So just kill it.
--
Piet van Oostrum <pi**@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: pi**@vanoostrum.org
Jul 10 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.