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

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

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


    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='y oursoftware' #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 !
    Windows brings your worlds together with the latest version of Windows OS. Learn how AI-powered features in Windows 11 give you more ways to work, play and create.
Working...