summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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