2 # Script for automagic finding&using hostnames/aliases of sites which are held
4 # Based on mnogosearch spec file.
5 # Adapted for pld by hunter@pld.org.pl, 8/09/2001
7 if [ -d /etc/httpd/httpd.conf ]; then
8 VHOSTS=/etc/httpd/httpd.conf/20_mod_vhost_alias.conf
9 HTTPCF=/etc/httpd/httpd.conf/10_httpd.conf
11 VHOSTS=/etc/httpd/mod_vhost_alias.conf
12 HTTPCF=/etc/httpd/httpd.conf
14 IDXRCF=/etc/mnogosearch/indexer.conf
15 TMPFILE=/tmp/mnogo.tmp
16 TMPFILE2=/tmp/mnogo2.tmp
17 ENTRIES="index.html index.htm index.php index.php3 index.shtml default.htm"
19 rm -f $TMPFILE $TMPFILE2
21 # First check for local sites in this file:
22 for i in `cat /etc/mnogosearch/locals`; do
23 echo $i >> $TMPFILE 2&1>/dev/null
26 #Then extract from $VHOSTS file
27 if [ -x $VHOSTS ]; then
28 for i in ; do echo $i >> $TMPFILE; done
31 #Determine localhost name
32 SERVERNAME="`cat $HTTPCF| grep -v "#" | grep ServerName| awk '{printf($2)}'`"
33 [ -z "$SERVERNAME" ] && SERVERNAME="`uname -n`"
34 #IF the two above fail use localhost
35 [ -z "$SERVERNAME" ] && SERVERNAME="localhost"
37 if [ -f $TMPFILE ]; then
38 for i in `cat $TMPFILE`; do echo "$i" >> $TMPFILE2; done
40 echo 'http://'$SERVERNAME >> $TMPFILE2
43 cat $IDXRCF | grep -v -e Server -e URL -e "#Added by"> $TMPFILE2
44 echo "#Added by $0, on `date`" >> $TMPFILE2
45 for i in `cat $TMPFILE`; do
46 echo "Server $i" >> $TMPFILE2
49 #Get url entries for hostnames
50 for i in `cat $TMPFILE`; do
52 echo "URL $i/$j" >> $TMPFILE2;
56 mv -f $TMPFILE2 $IDXRCF