Fix syntax error in check_ip function and handle unsuccessful attempts. Update wecker.sh: Fix syntax error in 'for' loop

This commit is contained in:
Ratatoskr 2023-12-27 12:47:55 +01:00
parent a44e6c91ba
commit 8c3bfed83f
Signed by: Ratatoskr
GPG Key ID: 28B77439A6D78F4E

View File

@ -46,7 +46,7 @@ check_ip() {
attempts=10 attempts=10
interval=5 interval=5
or ((i = 1; i <= $attempts; i++)); do for ((i = 1; i <= $attempts; i++)); do
A72_ip=$(arp-scan -r 5 -v --localnet | grep "$mac_address" | awk '{print $1}') A72_ip=$(arp-scan -r 5 -v --localnet | grep "$mac_address" | awk '{print $1}')
if [ -n "$A72_ip" ]; then if [ -n "$A72_ip" ]; then
@ -75,7 +75,9 @@ check_ip() {
# Alle Versuche erfolglos # Alle Versuche erfolglos
echo "Das Ziel konnte nach $attempts Versuchen nicht erreicht werden." echo "Das Ziel konnte nach $attempts Versuchen nicht erreicht werden."
iobroker state set zigbee.0.04cd15fffee03198.state false
return 1 # Fehler: Das Ziel konnte nicht erreicht werden return 1 # Fehler: Das Ziel konnte nicht erreicht werden
exit
} }
# check_ip -Funktion ausführen. # check_ip -Funktion ausführen.