diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-05-15 21:11:20 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-05-15 21:11:20 +0200 |
commit | 7cdb6949332b50e5e4d395c36db7c9892aba094a (patch) | |
tree | 68df4a0886a7fe1a0b7e2a374d92a29361c0b622 | |
download | w3watch-7cdb6949332b50e5e4d395c36db7c9892aba094a.tar.gz w3watch-7cdb6949332b50e5e4d395c36db7c9892aba094a.tar.xz |
initial commit
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | urls.sample | 6 | ||||
-rwxr-xr-x | w3watch | 50 |
3 files changed, 57 insertions, 0 deletions
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 @@ -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 |