On this Shell command example, I will show you the Shell command to check if a process is running or not. You can add the following command to your code to check if a process running or not. For example:
if ps aux | grep "[f]irefox" > /dev/null
The command above will check if Firefox is running or not. If it running, it will print “Running” and “Stopped” if there is no Firefox instance is running. Don’t forget to put  because if you don’t use the brackets, it will always return True. The square brackets are useful to avoid the output of the grep command. Without this the conditional will always return true, because the grep command start a process with the same content of the searched string.