From a0dbcefb1c96bfcd3275a2048463cbe12025a804 Mon Sep 17 00:00:00 2001 From: Ratatoskr Date: Thu, 7 Dec 2023 13:17:18 +0100 Subject: [PATCH] Refactor A72_alarm_getter.sh script for improved readability and reliability - Removed unnecessary variable interpolation in the 'echo' statement. - Changed the path for 'atq' and 'atrm' commands to use the full path. - Updated the 'ping' command to use the full path for better compatibility. - Added comments and improved formatting for better script understanding. --- A72_alarm_getter.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/A72_alarm_getter.sh b/A72_alarm_getter.sh index 581563f..ffedb0a 100755 --- a/A72_alarm_getter.sh +++ b/A72_alarm_getter.sh @@ -8,17 +8,18 @@ # dann das Einschalten der Lichter. # mit dem "at" Befehl. -echo "Ausgeführt um: $date" +echo "Ausgeführt um: " +date # Überprüfen, ob alte "at"-Aufträge abgelaufen sind und sie löschen delete_expired_at_jobs() { current_time=$(date +"%Y-%m-%d %H:%M:%S") - old_jobs=$(atq | awk -v current_time="$current_time" '$3 < current_time { print $1 }') + old_jobs=$(/usr/bin/atq | awk -v current_time="$current_time" '$3 < current_time { print $1 }') if [ -n "$old_jobs" ]; then echo "Lösche überholte 'at'-Jobs:" for job_id in $old_jobs; do - atrm "$job_id" + /usr/bin/atrm "$job_id" echo "Gelöscht: $job_id" done else @@ -45,7 +46,7 @@ weckzeit_datei="/root/iobroker_scripts/generel/.weckzeiten.txt" # Überprüfen, ob das Ziel über Ping erreichbar ist function is_target_reachable() { echo "teste ping $A72_ip" - local ping_output=$(ping -q -w 3 -c 3 $A72_ip 2>&1) + local ping_output=$(/bin/ping -q -w 3 -c 3 $A72_ip 2>&1) local ping_exit_code=$? echo "$ping_output" # Ausgabe des Ping-Befehls anzeigen