how to retreive PID of specific python script using pidof
Hello,
Im trying to write a simple script that will only launch a process if it is not already running. I want to use the return value from 'pidof' to find out whether it is running. However the process i am looking for is a script launched with python. Thus if I use "pidof python" I get multiple PIDs returned which is no use. I also thought of using return value from grep <script.py> but this returns the grep process aswell.. argh! Any ideas? |
Nevermind,
if you do a: ps ax | grep -v grep | grep process the middle command removes the grep process running from the list. You can then use the return result from this to branch your if statement |
All times are GMT -5. The time now is 12:42 AM. |