Compare commits

1 Commits

Author SHA1 Message Date
261ab584ae ping_websites.sh hinzugefügt 2025-11-18 08:14:54 +00:00

48
ping_websites.sh Normal file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
echo Script to detect if webpages are up and running
# Webseiten-Check-Skript
# Prüft, ob mehrere Webseiten erreichbar sind (HTTP-Status 200~@~S399)
#
# # Liste der zu prüfenden Webseiten
websites=(
"https://backup.ben-wagner.de"
"https://dns.ben-wagner.de"
"https://docu.ben-wagner.de"
"https://gaming.ben-wagner.de"
"https://git.ben-wagner.de"
"https://intranet.ben-wagner.de"
"https://kimai.ben-wagner.de"
"https://npm.ben-wagner.de"
"https://office.ben-wawgner.de"
"https://pbs.ben-wagner.de"
"https://pdf.ben-wagner.de"
"https://preprod.ben-wagner.de"
"https://pve.ben-wagner.de"
"https://pw.ben-wagner.de"
"https://technitium.ben-wagner.de"
"https://virtual.ben-wagner.de"
)
# Funktion zum Prüfen einer Webseite
check_website() {
local url="$1"
# Timeout 5 Sekunden, nur Header abrufen (-I), still (-s), Fehler anzeigen (-S)
http_code=$(curl -o /dev/null -s -w "%{http_code}" --max-time 5 -I "$url" 2>/dev/null)
# Prüfen, ob HTTP-Code gültig ist
if [[ "$http_code" =~ ^[0-9]{3}$ ]]; then
if (( http_code >= 200 && http_code < 400 )); then
echo "[OK] $url ist online (HTTP $http_code)"
else
echo "[FEHLER] $url antwortet, aber mit HTTP $http_code"
fi
else
echo "[FEHLER] $url ist nicht erreichbar"
fi
}
# Hauptschleife
for site in "${websites[@]}"; do
check_website "$site"
done