Chinaunix首页 | 论坛 | 博客
  • 博客访问: 434478
  • 博文数量: 75
  • 博客积分: 2780
  • 博客等级: 少校
  • 技术积分: 789
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-23 20:38
文章分类

全部博文(75)

文章存档

2012年(1)

2011年(11)

2010年(12)

2009年(39)

2008年(12)

我的朋友

分类: LINUX

2009-04-29 15:25:55

#!/bin/bash
#Add a vhost
#vhost configfile is vhost.conf
 
echo ""
echo ""      >> ./vhost.temp
echo "Options FollowSymLinks"   >> ./vhost.temp
echo "AllowOverride All"        >> ./vhost.temp
echo "Order allow,deny"         >> ./vhost.temp
echo "Allow from all"           >> ./vhost.temp
echo "AddDefaultCharset GBK"    >> ./vhost.temp
echo "Options +Includes"        >> ./vhost.temp
echo "
"             >> ./vhost.temp
echo ""                         >> ./vhost.temp
echo ""                         >> ./vhost.temp
echo ""       >> ./vhost.temp
echo "ServerName   "            >> ./vhost.temp
echo "DocumentRoot  "           >> ./vhost.temp
echo "DirectoryIndx index.shtml index.html index.php"   >> ./vhost.temp
echo "
"           >> ./vhost.temp
echo ""

echo "Please input Directory ( example \"/var/www/html/\" ):"
read Directory
echo ""
echo "Please input ServerName ( example "" ) :"
read ServerName
 
sed -e /Directory/{s:Directorypwd:${Directory}:} -e /ServerName/{s/$/$ServerName/} -e /DocumentRoot/{s:$:${Directory}:} vhost.temp >> vhost.conf
 
rm -f ./vhost.temp
 
echo ""
echo '###################'
echo '#                 #'
echo '# "Add vhost OK!" #'
echo '#                 #'
echo '###################'
echo ""
tail -n 16 vhost.conf
阅读(1223) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~