summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2009-05-15 21:11:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2009-05-15 21:11:20 +0200
commit7cdb6949332b50e5e4d395c36db7c9892aba094a (patch)
tree68df4a0886a7fe1a0b7e2a374d92a29361c0b622
downloadw3watch-7cdb6949332b50e5e4d395c36db7c9892aba094a.tar.gz
w3watch-7cdb6949332b50e5e4d395c36db7c9892aba094a.tar.xz
initial commit
-rw-r--r--.gitignore1
-rw-r--r--urls.sample6
-rwxr-xr-xw3watch50
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
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