123456789101112131415161718192021222324252627282930 |
- #!/usr/bin/env python3.9
- import os
- import signal
- PRO_PATH = "/platform/LAS/"
- PIDFILE = PRO_PATH + "LAS.pid"
- def is_running(pid):
- try:
- os.kill(pid, 0)
- return True
- except OSError:
- return False
- def status():
- if not os.path.exists(PIDFILE):
- print("LAS is NOT running (no PID file).")
- return
- with open(PIDFILE, "r") as f:
- pid = int(f.read())
- if is_running(pid):
- print(f"LAS is running with PID {pid}")
- else:
- print(f"LAS is NOT running (PID file found but process is gone).")
- if __name__ == "__main__":
- status()
|