checkt ip von a72
This commit is contained in:
parent
94dee024a4
commit
1d27119800
@ -11,7 +11,6 @@
|
||||
# Ü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")
|
||||
sleep 65
|
||||
old_jobs=$(atq | awk -v current_time="$current_time" '$3 < current_time { print $1 }')
|
||||
|
||||
if [ -n "$old_jobs" ]; then
|
||||
@ -28,12 +27,23 @@ delete_expired_at_jobs() {
|
||||
# Verwende die Funktion, um überholte Jobs zu löschen
|
||||
delete_expired_at_jobs
|
||||
|
||||
# Die IP-Adresse von Lisas-IPhone holen.
|
||||
check_ip() {
|
||||
mac_address="1e:46:8c:e4:cd:d1" # Ersetze dies # Die IP-Adresse von Lisas-IPhone holen.
|
||||
A72_ip=$(arp -a | grep "$mac_address" | awk '{print $2}' | sed 's/[()]//g')
|
||||
echo "$A72_ip"
|
||||
}
|
||||
|
||||
# check_ip -Funktion ausführen.
|
||||
check_ip
|
||||
|
||||
# Datei zum Speichern der geplanten Weckzeiten
|
||||
weckzeit_datei="/root/iobroker_scripts/generel/.weckzeiten.txt"
|
||||
|
||||
# Überprüfen, ob das Ziel über SSH erreichbar ist
|
||||
function is_target_reachable() {
|
||||
if ping -q -w 3 -c 3 192.168.178.99 &> /dev/null; then
|
||||
echo "teste ping $A72_ip"
|
||||
if ping -q -w 3 -c 3 $A72_ip &> /dev/null; then
|
||||
return 0 # Das Ziel ist erreichbar
|
||||
else
|
||||
return 1 # Das Ziel ist nicht erreichbar
|
||||
@ -43,7 +53,7 @@ function is_target_reachable() {
|
||||
# Überprüfen, ob das Ziel erreichbar ist
|
||||
if is_target_reachable; then
|
||||
# Ziel ist erreichbar, Alarmzeit über SSH abrufen
|
||||
alarmTime=$(ssh A72 dumpsys alarm | grep triggerTime | cut -d= -f2 | cut -c1-16 | uniq)
|
||||
alarmTime=$(ssh -i /root/.ssh/A72 root@$A72_ip dumpsys alarm | grep triggerTime | cut -d= -f2 | cut -c1-16 | uniq)
|
||||
|
||||
if [ -n "$alarmTime" ]; then
|
||||
# Zerlege das Datum und die Uhrzeit
|
||||
@ -66,7 +76,7 @@ if is_target_reachable; then
|
||||
echo "Weckzeit planen und in Datei speichern: $lightsOn"
|
||||
echo "$lightsOn" > "$weckzeit_datei"
|
||||
echo "/root/iobroker_scripts/schlafzimmer/wecker.sh" | at "$lightsOn"
|
||||
curl -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" -H "Icon:https://static.vecteezy.com/system/resources/previews/018/931/118/original/alarm-clock-icon-png.png" -H "Priority:High" -d "Alarm gestellt um: $(ssh A72 dumpsys alarm | grep triggerTime | cut -d= -f2 | cut -c12-16 | uniq)" https://ntfy.michaelis.digital/$HOSTNAME
|
||||
curl -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" -H "Icon:https://static.vecteezy.com/system/resources/previews/018/931/118/original/alarm-clock-icon-png.png" -H "Priority:High" -d "Alarm gestellt um: $(ssh -i /root/.ssh/A72 root@$A72_ip dumpsys alarm | grep triggerTime | cut -d= -f2 | cut -c12-16 | uniq)" https://ntfy.michaelis.digital/$HOSTNAME
|
||||
fi
|
||||
else
|
||||
echo "Kein Wecker gestellt. Lösche geplante Weckzeiten."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user