All pastes #635147 Raw Edit

Unbenannt

public shellscript v1 · immutable
#635147 ·published 2007-07-26 21:40 UTC
rendered paste body
#!/bin/bash###################################################################### checkpage.sh   v 0.2.3   (!c) by Michael Horn <nibbler@nibbler.de>###################################################################### global settings###################################################################### where to store the copy of the page we want to compare with?storefile=/tmp/_pagecheck-storefile# what url to checkurl=http://www12.informatik.uni-erlangen.de/edu/# where to send email notifiesmailaddr=changeme@nibbler.de# time in minutes to wait between periodic checkscheckmins=1#####################################################################ua="checkpage.sh by nibbler@nibbler.de"case $1 in        "--help")                echo usage: checkpage [fetch\|compare\|pcheck]		echo		echo \ \ \ \ \ \ \ fetch - fetch the page and store it in the storefile for later comparison		echo \ \ \ \ \ \ \ compare - compare the file on the server with the storefile and give diff output                echo \ \ \ \ \ \ \ pcheck - check periodically. if changed, notify by email		echo		echo due to the nature of the script you have to specify a fixed URL and a fixed		echo storefile in a variable as well as email address for notifies within the script.		echo                exit 0        ;;        "")                echo for usage information see --help                exit 0        ;;        "fetch")                wget -U $ua -q -O - $url|sed -r s/.PHPSESSID=\(.{32}\)//|sed -r s/.PHPSESSID=\(.{32}\)//>$storefile                exit 0	;;	"compare")		wget -U $ua -q -O - $url|sed -r s/.PHPSESSID=\(.{32}\)//|sed -r s/.PHPSESSID=\(.{32}\)//|diff $storefile -		exit 0	;;	"pcheck")		while true			do				case `wget -U $ua -q -O - $url|sed -r s/.PHPSESSID=\(.{32}\)//|sed -r s/.PHPSESSID=\(.{32}\)//|diff $storefile -` in					"")						sleep `echo 60*$checkmins|bc`					;;					*)						wget -U $ua -q -O - $url|sed -r s/.PHPSESSID=\(.{32}\)//|sed -r s/.PHPSESSID=\(.{32}\)//|diff $storefile -|sendmail $mailaddr						sleep `echo 60*$checkmins|bc`					;;				esac			done        ;;	*)		echo invalid syntax - please use --help		exit 1	;;esac