Terminate a python script from linux shell / bash script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gros Bedo

    Terminate a python script from linux shell / bash script


    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.
  • Larry Bates

    #2
    Re: Terminate a python script from linux shell / bash script

    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

    Comment

    • MRAB

      #3
      Re: Terminate a python script from linux shell / bash script

      On Jul 10, 1:25 am, Larry Bates <larry.ba...@we bsafe.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.

      Comment

      • Piet van Oostrum

        #4
        Re: Terminate a python script from linux shell / bash script

        >>>>Gros Bedo <gros_bedo@hotm ail.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
        >GBapplicatio n, 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 <piet@cs.uu.n l>
        URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C 4]
        Private email: piet@vanoostrum .org

        Comment

        Working...