[Bash] Script for monitoring content of website

[Bash] Script for monitoring content of website

Imagine that you are waiting for marks from exam. Lecturer is going to publish them on his website, but you don’t know when.
I’ve created following script, because I don’t like pressing F5 for hours 🙂
You have to provide address of website, and if website changes, script will open firefox and show notification.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
# Wojtek Jamrozy www.wojtekrj.net
 
if [ $# != 1 ]; then
	echo "usage: $0 <url of website> "
	exit 1
fi
hash=`wget -q -O - $1 | md5sum`
 
while [ 1 ]; do
	if [ "`wget -q -O - $1 | md5sum`" != "$hash" ]; then
		firefox $1
		notify-send "Change on the website $1"
		exit 0
	fi
	echo "Nothing has changed"
	sleep 120
done

One thought on “[Bash] Script for monitoring content of website

Leave a Reply

Your email address will not be published. Required fields are marked *