]> git.pld-linux.org Git - packages/mnogosearch.git/blame - mnogosearch-gethostnames
- updated to 3.2.34
[packages/mnogosearch.git] / mnogosearch-gethostnames
CommitLineData
86a7e6b5 1#!/bin/sh
2# Script for automagic finding&using hostnames/aliases of sites which are held
3# on this server.
4# Based on mnogosearch spec file.
5# Adapted for pld by hunter@pld.org.pl, 8/09/2001
6
dd0a351c
AM
7if [ -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
10else
11 VHOSTS=/etc/httpd/mod_vhost_alias.conf
12 HTTPCF=/etc/httpd/httpd.conf
13fi
148604ff 14IDXRCF=/etc/mnogosearch/indexer.conf
86a7e6b5 15TMPFILE=/tmp/mnogo.tmp
16TMPFILE2=/tmp/mnogo2.tmp
17ENTRIES="index.html index.htm index.php index.php3 index.shtml default.htm"
18
19rm -f $TMPFILE $TMPFILE2
20
21# First check for local sites in this file:
148604ff 22for i in `cat /etc/mnogosearch/locals`; do
23 echo $i >> $TMPFILE 2&1>/dev/null
86a7e6b5 24done
25
26#Then extract from $VHOSTS file
27if [ -x $VHOSTS ]; then
28 for i in ; do echo $i >> $TMPFILE; done
29fi
30
31#Determine localhost name
32SERVERNAME="`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"
36
148604ff 37if [ -f $TMPFILE ]; then
38 for i in `cat $TMPFILE`; do echo "$i" >> $TMPFILE2; done
39fi
40echo 'http://'$SERVERNAME >> $TMPFILE2
86a7e6b5 41mv $TMPFILE2 $TMPFILE
42
43cat $IDXRCF | grep -v -e Server -e URL -e "#Added by"> $TMPFILE2
44echo "#Added by $0, on `date`" >> $TMPFILE2
45for i in `cat $TMPFILE`; do
46 echo "Server $i" >> $TMPFILE2
47done
48
49#Get url entries for hostnames
50for i in `cat $TMPFILE`; do
51 for j in $ENTRIES; do
52 echo "URL $i/$j" >> $TMPFILE2;
53 done
54done
55
56mv -f $TMPFILE2 $IDXRCF
57rm -f $TMPFILE
This page took 0.029675 seconds and 4 git commands to generate.