1234567891011121314151617181920212223242526 |
- #!/usr/bin/env python3.9
- import os
- import signal
- PRO_PATH = "/platform/LAS/"
- PIDFILE = PRO_PATH + "LAS.pid"
- def stop():
- if not os.path.exists(PIDFILE):
- print("No PID file found. Is LAS running?")
- return
- with open(PIDFILE, "r") as f:
- pid = int(f.read())
- try:
- os.kill(pid, signal.SIGTERM)
- print(f"Stopped LAS (PID {pid})")
- except ProcessLookupError:
- print(f"No process found with PID {pid}")
- finally:
- os.remove(PIDFILE)
- if __name__ == "__main__":
- stop()
|