Skip to content

Commit a526c6c

Browse files
author
root
committed
Add db config to WEB_DIR
1 parent 7851f6d commit a526c6c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

create_nginx_vhost/create_site_simple.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DOMAIN=$prefix.$1
2020
PATTERN="^([[:alnum:]]([[:alnum:]\-]{0,61}[[:alnum:]])?\.)+[[:alpha:]]{2,6}$"
2121
if [[ "$DOMAIN" =~ $PATTERN ]]; then
2222
DOMAIN=`echo $DOMAIN | tr '[A-Z]' '[a-z]'`
23-
output="Creating hosting for:" $DOMAIN
23+
output="Creating hosting for:"$DOMAIN
2424
else
2525
status="0"
2626
output="invalid domain name"
@@ -65,6 +65,7 @@ sudo chown vagrant:vagrant $WEB_DIR/$SITE_DIR/index.html
6565
#echo -e $"create mysql database core--$DOMAIN start \n"
6666
#sh /home/vagrant/sync/shell/create_nginx_vhost/mysql.sh "core"$prefix
6767

68+
6869
MYSQL_BIN="/usr/local/mysql/bin/mysql"
6970
MYSQL_ROOT="stars"
7071
MYSQL_PASS="123456"
@@ -81,6 +82,11 @@ else
8182
$MYSQL_BIN -u "$MYSQL_ROOT" -e "SHOW DATABASES"
8283
fi
8384

85+
### Add db config to WEB_DIR
86+
sudo cp $CURRENT_DIR/db.php $WEB_DIR/$SITE_DIR/$DOMAIN.php
87+
sudo $SED -i "s/CORE/$DB/g" $WEB_DIR/$SITE_DIR/$DOMAIN.php
88+
sudo chown vagrant:vagrant $WEB_DIR/$SITE_DIR/$DOMAIN.php
89+
8490
output='Site Created for '$DOMAIN
8591
echo -e "{\"status\":\""$status"\", \"msg\":\""$output"\",\"data\":\""$DOMAIN"\", \"uptime\":\""$date"\"}"
8692
exit;

0 commit comments

Comments
 (0)