Fixed stopping main server from console

This commit is contained in:
Krateng 2020-03-08 01:27:55 +01:00
parent 9cf1fb3ed8
commit eb82282e58
3 changed files with 14 additions and 10 deletions

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@krateng.dev", "email":"maloja@krateng.dev",
"github": "krateng" "github": "krateng"
} }
version = 2,3,3 version = 2,3,4
versionstr = ".".join(str(n) for n in version) versionstr = ".".join(str(n) for n in version)
links = { links = {
"pypi":"malojaserver", "pypi":"malojaserver",

View File

@ -126,20 +126,25 @@ def stop():
pid_sv = getInstanceSupervisor() pid_sv = getInstanceSupervisor()
if pid_sv is not None: if pid_sv is not None:
os.kill(pid_sv,signal.SIGTERM) os.kill(pid_sv,signal.SIGTERM)
return True # return True
else: # else:
print("Server is not running")
return False
# pid = getInstance()
# if pid is None:
# print("Server is not running") # print("Server is not running")
# return False # return False
pid = getInstance()
if pid is not None:
# print("Server is not running")
# return False
# pass
# else: # else:
# os.kill(pid,signal.SIGTERM) os.kill(pid,signal.SIGTERM)
# print("Maloja stopped! PID: " + str(pid)) # print("Maloja stopped! PID: " + str(pid))
if pid is not None or pid_sv is not None:
return True return True
else:
return False
def loadlastfm(filename): def loadlastfm(filename):

View File

@ -31,7 +31,6 @@ def update():
def start(): def start():
try: try:
p = subprocess.Popen(["python3","-m","maloja.server"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL) p = subprocess.Popen(["python3","-m","maloja.server"],stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
log(p,module="supervisor")
except e: except e:
log("Error starting Maloja: " + str(e),module="supervisor") log("Error starting Maloja: " + str(e),module="supervisor")