#! /bin/ksh # ==================================================================== # @(#) refresh content of mirrored web pages # ==================================================================== # a Korn shell script # Written by: David Boldt 1 Dec 2000 # -------------------------------------------------------------------- # temp='temp.html' # for each index file ls */*/index.html | while read file; do # extract the publication identifier publicaton=${file%/index.html} publicaton=${publicaton##*/} # obtain the persistent URL url=$(/www/cgi-bin/lookup/getreport $publicaton | sed 's/Location: //;q') echo "fetching $publicaton: $url ..." # if we got an error message, skip this document case $url in Content-type:*) echo " Not registered!!" continue ;; esac # copy the remote document to here GET $url > $temp # if we have a non-empty file if [ -s $temp ]; then # if the new file is different than the old file ... if [ $(sum $temp | cut -d' ' -f1) -ne $(sum $file | cut -d' ' -f1) ]; then # copy the new file into place cat $temp >| $file echo " updated!" else echo " already up to date." fi fi rm $temp done