Compare commits
2 Commits
65448fd8f4
...
ea1489341f
| Author | SHA1 | Date | |
|---|---|---|---|
| ea1489341f | |||
| a70f7dc167 |
@ -14,6 +14,7 @@ fi
|
|||||||
# === Variablen ===
|
# === Variablen ===
|
||||||
WHOAMI=$(whoami)
|
WHOAMI=$(whoami)
|
||||||
USER=${SUDO_USER:-$WHOAMI}
|
USER=${SUDO_USER:-$WHOAMI}
|
||||||
|
DIR=$(pwd)
|
||||||
|
|
||||||
# === Skript-Funktionen ===
|
# === Skript-Funktionen ===
|
||||||
cleanup() {
|
cleanup() {
|
||||||
@ -50,7 +51,9 @@ trap cleanup SIGINT
|
|||||||
|
|
||||||
wait_for_internet_connection
|
wait_for_internet_connection
|
||||||
|
|
||||||
sudo -u $USER git pull |& while IFS= read -r line; do log "$line"; done
|
cd "$(dirname "$0")"
|
||||||
|
sudo -u "$USER" git pull |& while IFS= read -r line; do log "$line"; done
|
||||||
|
cd "$DIR"
|
||||||
|
|
||||||
update_packages
|
update_packages
|
||||||
update_flatpak
|
update_flatpak
|
||||||
|
|||||||
@ -7,14 +7,14 @@ source "$SCRIPT_DIR/Log.sh"
|
|||||||
|
|
||||||
# === KONFIGURATION ===
|
# === KONFIGURATION ===
|
||||||
PING_RETRIES=5 # Anzahl der PING-Versuche vor WOL
|
PING_RETRIES=5 # Anzahl der PING-Versuche vor WOL
|
||||||
WOL_RETRIES=2 # Max. Anzahl der WOL-Versuche
|
WOL_RETRIES=5 # Max. Anzahl der WOL-Versuche
|
||||||
WOL_WAIT=30 # Wartezeit nach WOL (Sekunden)
|
WOL_WAIT=60 # Wartezeit nach WOL (Sekunden)
|
||||||
|
|
||||||
# === FUNKTIONEN ===
|
# === FUNKTIONEN ===
|
||||||
|
|
||||||
is_reachable() {
|
is_reachable() {
|
||||||
local device_ip="$1"
|
local device_ip="$1"
|
||||||
for ((i=1; i<=PING_RETRIES; i++)); do
|
for ((i = 1; i<=PING_RETRIES; i++)); do
|
||||||
log "Teste Erreichbarkeit von $device_ip - Versuch $i/$PING_RETRIES..."
|
log "Teste Erreichbarkeit von $device_ip - Versuch $i/$PING_RETRIES..."
|
||||||
if ping -c 1 -W 2 "$device_ip" &>/dev/null; then
|
if ping -c 1 -W 2 "$device_ip" &>/dev/null; then
|
||||||
log "Gerät $device_ip ist erreichbar."
|
log "Gerät $device_ip ist erreichbar."
|
||||||
@ -58,7 +58,7 @@ wake_device() {
|
|||||||
|
|
||||||
check_wol_installed || return 1 # WOL-Tool prüfen, wenn nicht da, Abbruch
|
check_wol_installed || return 1 # WOL-Tool prüfen, wenn nicht da, Abbruch
|
||||||
|
|
||||||
for ((attempt=1; attempt<=WOL_RETRIES; attempt++)); do
|
for ((attempt = 1; attempt<=WOL_RETRIES; attempt++)); do
|
||||||
log "Wake-on-LAN Versuch $attempt/$WOL_RETRIES..."
|
log "Wake-on-LAN Versuch $attempt/$WOL_RETRIES..."
|
||||||
send_wol "$device_mac"
|
send_wol "$device_mac"
|
||||||
log "Warte $WOL_WAIT Sekunden..."
|
log "Warte $WOL_WAIT Sekunden..."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user