From fe953d07b146f5967a9dabbf4248ab624fb70bc5 Mon Sep 17 00:00:00 2001 From: Krateng Date: Wed, 16 Oct 2019 15:09:15 +0200 Subject: [PATCH] Added log output to supervisor --- supervisor.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/supervisor.py b/supervisor.py index 706ed13..824c2a2 100644 --- a/supervisor.py +++ b/supervisor.py @@ -4,6 +4,7 @@ import subprocess import time import setproctitle import signal +from doreah.logging import log setproctitle.setproctitle("maloja_supervisor") @@ -15,6 +16,10 @@ while True: try: output = subprocess.check_output(["pidof","Maloja"]) pid = int(output) + log("Maloja is running, PID " + str(pid),module="supervisor") except: - print("Maloja not running, restarting...") - p = subprocess.Popen(["python3","server.py"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) + log("Maloja is not running, restarting...",module="supervisor") + try: + p = subprocess.Popen(["python3","server.py"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) + except e: + log("Error starting Maloja: " + str(e),module="supervisor")