Created
May 26, 2025 17:41
-
-
Save dewomser/ece470f6fe78208f07cd0f02ab5ca945 to your computer and use it in GitHub Desktop.
Webseite auf neue Version prüfen. Hash vergleichen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
URL="https:/blog.fefe.de" # Ersetze mit der gewünschten URL | |
HASH_FILE="hash.txt" | |
# Lade den HTML-Inhalt der Webseite und berechne den SHA256-Hash | |
CURRENT_HASH=$(curl -s "$URL" | sha256sum | awk '{print $1}') | |
# Prüfe, ob eine vorherige Hash-Datei existiert | |
if [ -f "$HASH_FILE" ]; then | |
PREVIOUS_HASH=$(cat "$HASH_FILE") | |
if [ "$CURRENT_HASH" != "$PREVIOUS_HASH" ]; then | |
echo "Die Webseite wurde aktualisiert!" | |
else | |
echo "Keine Änderung an der Webseite." | |
fi | |
else | |
echo "Erstmalige Überprüfung, Hash gespeichert." | |
fi | |
# Speichere den aktuellen Hash | |
echo "$CURRENT_HASH" > "$HASH_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment