Fix incorrect message while reloading nginx + more details on error

This commit is contained in:
TheophileDiot 2022-10-04 11:43:26 +02:00
parent 7860aeab94
commit a96a8a8c2f
1 changed files with 3 additions and 3 deletions

View File

@ -50,12 +50,12 @@ class JobScheduler(ApiCaller) :
reload = True
if os.path.isfile("/usr/sbin/nginx") and os.path.isfile("/opt/bunkerweb/tmp/nginx.pid") :
log("SCHEDULER", "", "Reloading nginx ...")
proc = subprocess.run(["/usr/sbin/nginx", "-s", "reload"], stdin=subprocess.DEVNULL, stderr=subprocess.STDOUT, env=self.__env)
reload = proc.returncode != 0
proc = subprocess.run(["/usr/sbin/nginx", "-s", "reload"], stdin=subprocess.DEVNULL, stderr=subprocess.PIPE, env=self.__env)
reload = proc.returncode == 0
if reload :
log("SCHEDULER", "", "Successfuly reloaded nginx")
else :
log("SCHEDULER", "", "Error while reloading nginx")
log("SCHEDULER", "", "Error while reloading nginx - returncode: " + str(proc.returncode) + " - error: " + proc.stderr.decode("utf-8"))
else :
log("SCHEDULER", "", "Reloading nginx ...")
reload = self._send_to_apis("POST", "/reload")