1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added log output to supervisor

This commit is contained in:
Krateng 2019-10-16 15:09:15 +02:00
parent 2170350315
commit fe953d07b1

View File

@ -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...")
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")