Patricks Blog

the happiest place on the web
Posts tagged "Hi"

Hi Leute,

ich hoste einige Server bei Hetzner, da die im Moment Probleme haben und ich des öfteren http://hetzner-status.de aufrufe habe ich mir ein kleines Script gebastelt welches die Seite aufruft und mir ein Notify rauswirft wenn sich etwas verändert. Man könnte dort auch ein “mail” oder so etwas einbauen.

 
#!/bin/sh

URLCHK="http://www.hetzner-status.de/"
TMPFILE="hetzner"

echo "Checke den $URLCHK Status ... \nStrg+C zum beenden"
test -f /tmp/${TMPFILE}_old.tmp || wget -q $URLCHK -O /tmp/${TMPFILE}_old.tmp 

while true; do
    wget -q $URLCHK -O /tmp/${TMPFILE}_.tmp
    
    if [ "$(md5sum /tmp/${TMPFILE}_old.tmp | awk '{ print $1 }')" != "$(md5sum /tmp/${TMPFILE}.tmp | awk '{ print $1 }')" ]; then
        notify-send "$URLCHK" "Der $URLCHK Status hat sich verändert"
        cp /tmp/${TMPFILE}.tmp /tmp/${TMPFILE}_old.tmp
    fi  
    
    sleep 60
done