I'm fairly new to Python.
I'm running a python script on Linux named "locationGPIO2.py". I'm trying to write a separate script to monitor whether "locationGPIO2.py" is running at all times.
I want this separate script to basically be looping and checking if "locationGPIO2.py" is running, if it is, then do nothing, but if it is no longer running (either by user stopping the script or by crashing) then change a variable named 'heartbeat' to "Inactive".
I've been looking around for a solution for a while, but can't find anything that works. Could anybody help me implement this into my script?
Here's what I imagine the script should do:
ENTER CHECK IF SCRIPT IS RUNNING CODE HERE
If locationGPIO2.py is NOT running THEN:
heartbeat = "Inactive"
Else:
Do nothing