All pastes #1470208 Raw Edit

Unnamed

public shellscript v1 · immutable
#1470208 ·published 2009-06-22 19:50 UTC
rendered paste body
#!/bin/bash# a simple script to check if a site has changed# utilizes curl and sha1sum, so I guess these would be the dependiences# information in the format [HH:MM:SS] <url> has changed# is currently output to stdout, expect improvements here# there is also minimal error checking, so it'll probably get fucked up# with some exotic URLs or protocols or whatever# XAVeRY 2009, public domain lolif [ $# -ne 4 ] || [ $1 != "-u" ] || [ $3 != "-p" ]; then	echo "Usage : $0 -u <url to check> -p <period in seconds>"	exitfinewsum=""oldsum=""while [ TRUE ] ; do	curl -s -o .tmpfile $2	if [ $? -ne 0 ]; then		echo 'curl execution returned an error, killing script...'		exit	fi	nowasuma=`sha1sum .tmpfile | cut -b -40`	if [ $nowasuma != $starasuma ]; then		echo "[`date +%T`] $2 has changed!"	fi	starasuma=$nowasuma	sleep $4done