#!/bin/sh # vhost_setup v1.0 (c) 8.10.2002 by Andreas Ley (u) 9.10.2002 # Run interface setup commands to add virtual interfaces for virtual hosts root=/usr/local/etc/httpd usage() { echo "Usage: `basename $0` [-v]" >&2 echo "-v verbose mode" >&2 exit 1 } set -- `getopt hxv $*` || usage trace=false verbose=false while :; do case $1 in -h) sed '1d;s/^# *//;/^$/q' $0; usage;; -x) set -x; trace=true; shift;; -v) verbose=true; shift;; --) shift; break;; esac done test $# -ne 0 && usage cd ${root}/conf/vhosts || exit 1 cnt=1 sed -n 's/^$/\1/p' *.*.* | \ sort -u -n -t. -k1,1 -k2,2 -k3,3 -k4,4 | \ while read ip; do %ifdef OS_LINUX ${verbose} && echo "/sbin/ifconfig eth0:${cnt} ${ip}" /sbin/ifconfig "eth0:${cnt}" "${ip}" %endif cnt=`expr ${cnt} + 1` done exit 0