wifi-reconnect.sh hinzugefügt

This commit is contained in:
2026-01-29 13:35:57 +00:00
parent 089da42db8
commit c719afc053

24
wifi-reconnect.sh Normal file
View File

@@ -0,0 +1,24 @@
#!/bin/bash
# Auto-Reconnect WiFi und Restart Services
LOG_FILE="./wifi-reconnect.log"
# Prüfe WiFi Verbindung
if ! ping -c 1 192.168.178.1 > /dev/null 2>&1; then
echo "[$(date)] : Keine WiFi Verbindung!" >> $LOG_FILE
# Schalte WiFi Adapter aus/ein
sudo /sbin/ifconfig wlan0 down
sleep 2
sudo /sbin/ifconfig wlan0 up
# Warte auf Reconnect
sleep 10
# Überprüfe erneut
if ping -c 1 192.168.178.1 > /dev/null 2>&1; then
echo "[$(date)] : WiFi wiederhergestellt" >> $LOG_FILE
else
echo "[$(date)] : WiFi Reconnect fehlgeschlagen" >> $LOG_FILE
fi
fi