Files
ops-hermes/bin/hermes
itismadness 45dedd576f git dump
2020-10-11 15:29:34 +00:00

21 lines
506 B
Python

#! /usr/bin/env python3
import os
from hermes import run_hermes
from hermes.hermes import HERMES_DIR
PID = str(os.getpid())
os.makedirs(HERMES_DIR, exist_ok=True)
PIDFILE = os.path.join(HERMES_DIR, "hermes.pid")
if __name__ == "__main__":
if os.path.isfile(PIDFILE):
print("{} already exists, exiting".format(PIDFILE))
raise SystemExit
with open(PIDFILE, 'w') as open_pidfile:
open_pidfile.write(PID)
try:
run_hermes()
finally:
os.unlink(PIDFILE)