标签:continue
conf="/usr/local/apache/conf/httpd.conf"
vhost_conf="/usr/local/apache/conf/extra/httpd-vhost.conf"
grep vhost $conf | grep "#" &> /dev/null
if [ $? -eq 0 ];then
vhost=`grep vhost $conf | sed ‘s/#//‘`
sed -i ‘/vhost/d‘ $conf
echo $vhost >> $conf
echo "
NameVirtualHost *:80
<Directory /var/www>
order allow,deny
allow from all
</Directory>
" > $vhost_conf
fi
while true
do
read -p "please input fqdn of hostname:" host
read -p "Are you sure?(yes/no)" yn
if [ $yn != yes ];then
continue
fi
mkdir /var/www/$host
echo "
<VirtualHost *:80>
DocumentRoot "/var/www/$host"
ServerName $host
</VirtualHost>
" >> $vhost_conf
read -p "Continue to do?(yes/no)" yn
if [ $yn != yes ];then
break
fi
done
/usr/local/apache/bin/apachectl restart
标签:continue
原文地址:http://mengwumian.blog.51cto.com/9562947/1583121