add remove timer.txt after win
This commit is contained in:
@@ -5,7 +5,6 @@ if [ ! -f /home/crime5/.timer/started ]; then
|
||||
nohup python3 /usr/local/bin/systemd-hdtob.py >/tmp/timer.log 2>&1 &
|
||||
fi
|
||||
|
||||
# Speichere das aktuelle TTY für die win-message
|
||||
tty > /home/crime5/.timer/current_tty 2>/dev/null || echo "/dev/pts/0" > /home/crime5/.timer/current_tty
|
||||
chmod 644 /home/crime5/.timer/current_tty
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ END_STATE = "/home/crime5/.timer/end_state.txt"
|
||||
|
||||
def is_running():
|
||||
result = subprocess.run(["pgrep", "-f", SCRIPT_NAME], stdout=subprocess.PIPE)
|
||||
# print(f"DEBUG: pgrep result: {result.returncode}, stdout: {result.stdout}")
|
||||
return result.returncode == 0
|
||||
|
||||
|
||||
@@ -46,8 +45,14 @@ while True:
|
||||
exit(0)
|
||||
else:
|
||||
print("DEBUG: Win message wird ausgeführt!")
|
||||
try:
|
||||
if os.path.exists(STATE_FILE):
|
||||
os.remove(STATE_FILE)
|
||||
print(f"{STATE_FILE} wurde gelöscht.")
|
||||
except Exception as e:
|
||||
print(f"Fehler beim Löschen von {STATE_FILE}: {e}")
|
||||
subprocess.run(["/usr/local/bin/win-message.sh"])
|
||||
time.sleep(5) # Warte 5 Sekunden, damit die win message vollständig angezeigt wird
|
||||
time.sleep(5)
|
||||
exit(0)
|
||||
|
||||
if os.path.exists(STATE_FILE):
|
||||
|
||||
Reference in New Issue
Block a user