import psutil
import time

def track_process(process_name):
    while True:
        # Get a list of all running processes
        process_found = False
        for proc in psutil.process_iter(['pid', 'name']):
            try:
                if proc.info['name'] == process_name:
                    print(f"Process '{process_name}' is running with PID: {proc.info['pid']}")
                    process_found = True
                    break
            except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
                pass
        
        if not process_found:
            print(f"Process '{process_name}' is not running.")
        
        time.sleep(300)  # Check every 300 seconds

track_process("uvicorn")

