Created
May 26, 2025 17:29
-
-
Save dewomser/e9fad32fb86fabe578bd4411d3f37751 to your computer and use it in GitHub Desktop.
Webseite auf neue Version prüfen. Zeitstempel 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 | |
TIMESTAMP_FILE="timestamp.txt" | |
# Abrufe die aktuelle Zeitstempel-Information der Webseite | |
CURRENT_TIMESTAMP=$(curl -sI "$URL" | grep -i "Last-Modified" | awk '{print $2, $3, $4, $5, $6}') | |
# Prüfe, ob eine vorherige Zeitstempel-Datei existiert | |
if [ -f "$TIMESTAMP_FILE" ]; then | |
PREVIOUS_TIMESTAMP=$(cat "$TIMESTAMP_FILE") | |
if [ "$CURRENT_TIMESTAMP" != "$PREVIOUS_TIMESTAMP" ]; then | |
echo "Die Webseite wurde aktualisiert!" | |
else | |
echo "Keine Änderung an der Webseite." | |
fi | |
else | |
echo "Erstmalige Überprüfung, Zeitstempel gespeichert." | |
fi | |
# Speichere den aktuellen Zeitstempel | |
echo "$CURRENT_TIMESTAMP" > "$TIMESTAMP_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment