#!/bin/sh DOMAIN=$1 SITEADMIN=$2 ## grab the site number SITENUM=`/usr/local/bin/sitelookup -d $DOMAIN site_handle` ## has this site had MySQL enabled? MYSQL_ENABLED=`/bin/cat /home/virtual/$SITENUM/info/current/mysql | /bin/grep ^enabled | /bin/awk '{print $3}'` ## only do the rest if mysql has been enabled for this site if [ "$MYSQL_ENABLED" -eq 1 ] then ## we also need our DB_Prefix PREFIX=`/bin/cat /home/virtual/$SITENUM/info/current/mysql | /bin/grep ^dbaseprefix | /bin/awk '{print $3}'` DB="01" ## the command below creates a lock-file that hangs us, schedule to remove these lock files in 1 minute /usr/bin/at -m -f /etc/appliance/rmLocks now + 1 minutes ## create a db for this site /usr/bin/python /usr/lib/opcenter/mysql/create_db.pyc -d $PREFIX$DB -n $DOMAIN -u $SITEADMIN ## mysql root password PWD="" ## update the new user & db /usr/bin/mysql -uroot -p$PWD --execute="UPDATE mysql.user SET Host='%' WHERE User='$SITEADMIN' AND Host='127.0.0.1';" /usr/bin/mysql -uroot -p$PWD --execute="UPDATE mysql.db SET Host='%' WHERE User='$SITEADMIN' AND Host='127.0.0.1';" /usr/bin/mysql -uroot -p$PWD --execute="FLUSH PRIVILEGES;" fi