From 7cdb6949332b50e5e4d395c36db7c9892aba094a Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 May 2009 21:11:20 +0200 Subject: initial commit --- .gitignore | 1 + urls.sample | 6 ++++++ w3watch | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .gitignore create mode 100644 urls.sample create mode 100755 w3watch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/urls.sample b/urls.sample new file mode 100644 index 0000000..d1a48cf --- /dev/null +++ b/urls.sample @@ -0,0 +1,6 @@ +http://www.cmake.org/cmake/resources/software.html +http://www.hardened-php.net/suhosin/download.html +http://pecl.php.net/package-changelog.php?package=APC +http://delta.affinix.com/download/qca/2.0/ +http://psi-im.org/download/ +http://labs.adobe.com/downloads/flashplayer10.html diff --git a/w3watch b/w3watch new file mode 100755 index 0000000..02d97e4 --- /dev/null +++ b/w3watch @@ -0,0 +1,50 @@ +#!/bin/bash + +mkdir -p ~/.w3watch/cache || exit 1 + +if [ ! -f ~/.w3watch/urls ]; then + echo "~/.w3watch/urls not found!" + exit 1 +fi + +if [ -f ~/.w3watch/lock ]; then + echo "w3watch already running" + exit 1 +fi + +touch ~/.w3watch/lock || exit 1 + + +for i in $(cat ~/.w3watch/urls); do + dump=$(lynx -dump "$i") + if [ $? -ne 0 ]; then + rm -f ~/.w3watch/lock + exit 1 + fi + + sum=$(echo "$i" | sha1sum | awk '{print $1;}') + cachefile=~/.w3watch/cache/${sum} + + if [ -f "$cachefile" ]; then + echo "$dump" | diff -u --label "$i" "$cachefile" - + fi + + echo "$dump" > "$cachefile" +done + +# remove old cache entries +for i in ~/.w3watch/cache/*; do + sumi=$(basename "$i") + + for j in $(cat ~/.w3watch/urls); do + sumj=$(echo "$j" | sha1sum | awk '{print $1;}') + + if [ "$sumi" == "$sumj" ]; then + continue 2 + fi + done + + rm -f $i +done + +rm -f touch ~/.w3watch/lock \ No newline at end of file -- cgit v1.2.3-24-g4f1b