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