modified: app.py
This commit is contained in:
12
app.py
12
app.py
@@ -38,11 +38,13 @@ ASKNOTES_INTRO_FILE = "asknotesintro.txt"
|
|||||||
bot_process = None
|
bot_process = None
|
||||||
|
|
||||||
def bot_status():
|
def bot_status():
|
||||||
"""Überprüft, ob der Bot läuft."""
|
"""Überprüft, ob der Bot läuft, indem der Prozess nach dem Skript-Namen durchsucht wird."""
|
||||||
global bot_process
|
for proc in psutil.process_iter(['pid', 'name', 'cmdline']):
|
||||||
if bot_process is None:
|
# Überprüfen, ob 'bot.py' im Befehlszeilen-Argument des Prozesses vorhanden ist
|
||||||
return False
|
if 'python' in proc.info['name'] and 'bot.py' in proc.info['cmdline']:
|
||||||
return bot_process.poll() is None # None bedeutet, dass der Prozess noch läuft
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def start_bot():
|
def start_bot():
|
||||||
"""Startet den Bot."""
|
"""Startet den Bot."""
|
||||||
|
|||||||
Reference in New Issue
Block a user