:
# httpd_mkindex - create an index file // Nov 17th 1993
# 
# (C) Christian Neuss, Fraunhofer IGD (neuss@igd.fhg.de) 

# Have this script called up on a regular base via 'cron'.
# Make sure that, for security reasons, it is being executed
# with a user id other then root, and that this user has
# both read access to the html files and write access to
# the index file.
# Here's an example of a crontab entry:
# 1 20 * * *	neuss	/bin/sh /usr/local/httpd_mkindex >/dev/console 2>&1


#--- start of configuration --- put your changes here ---
# The directory/directories to scan for html-files.
# It's better to supply a tailing "/" for each directory,
# since otherwise automounting won't work.
# Example:
#  SEARCHDIRS="/usr/www/dir/ /tmp/html/ /usr/foo/html-dir/" 
SEARCHDIRS="/icib/"

# Name of the index file.
# Example:
#  INDEX="/usr/local/httpd/index.idx"
INDEX="/LocalLibrary/SERVER/index/index.idx"
#--- end of configuration --- don't change anything below ---

find $SEARCHDIRS -type f -name '*.html' -print |
(
  while read file
	do
	  echo $file
    tr -cs A-Za-z0-9 '\012' < $file | tr A-Z a-z | sort | uniq -c | \
    awk '/[A-z][A-z].*/ {printf"%s %s\n",$1,$2;}"'
	done
) > $INDEX
