Terminate a python script from linux shell / bash script

Gros Bedo gros_bedo at hotmail.com
Sun Jul 13 14:59:04 EDT 2008


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


More information about the Python-list mailing list