RE: Terminate a python script from linux shell / bash script

Discussion in 'Python' started by Gros Bedo, Jul 13, 2008.

  1. Gros Bedo

    Gros Bedo Guest

    Thank you guys for your help. My problem is that I project to use this command to terminate a script when uninstalling the software, so I can't store the PID. This command will be integrated in the spec file of the RPM package. Here's the script I'll use, it may help someone else:

    #!/bin/sh
    # PYTHON SCRIPT PROCESS KILLER by GBO v0.1
    # This script will look for all the lines containing $SOFTWARENAME in the process list, and close them

    SOFTWARENAME='yoursoftware' #This is case insensitive
    JOBPRESENT=$(ps -ef | grep -i $SOFTWARENAME | grep -v grep)
    echo $JOBPRESENT
    ps -ef | grep -i $SOFTWARENAME | grep -v grep | awk '{print $2}' | xargs kill
    _________________________________________________________________
    Pendant tout l'été, consultez vos emails Hotmail sur votre mobile !
    http://www.messengersurvotremobile.com/?d=hotmail
    Gros Bedo, Jul 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William Park

    (patch for Bash) GTK+2 + Bash

    William Park, Jul 11, 2005, in forum: XML
    Replies:
    3
    Views:
    2,293
    William Park
    Jul 14, 2005
  2. Gros Bedo
    Replies:
    2
    Views:
    1,287
    Piet van Oostrum
    Jul 10, 2008
  3. Gros Bedo
    Replies:
    1
    Views:
    660
    Piet van Oostrum
    Jul 10, 2008
  4. norseman
    Replies:
    0
    Views:
    560
    norseman
    Jul 10, 2008
  5. edwithad

    Bash shell to Python shell?

    edwithad, Sep 28, 2009, in forum: Python
    Replies:
    4
    Views:
    1,730
Loading...

Share This Page