Current time: 11-23-2024, 01:03 PM Hello There, Guest! (LoginRegister)


Post Reply 
Migrating VHCS on Ubuntu 8.04
Author Message
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #2
RE: Migrating VHCS on Ubuntu 8.04
I think that libperl5.8 should be ok. I just migrated 300+ accounts this way:
I did export following tables:
Quote:admin ftp_group htaccess_groups mail_users reseller_props sql_user auto_num ftp_users htaccess quotalimits server_ips subdomain domain hosting_plans htaccess_users quotatallies sql_database user_gui_props
and after instalation i did a manual import of this tables in ispcp database. I saved /var/www/virtual and /var/lib/mysql in /oldvhcs/var/www/ respectively /oldvhcs/var/lib/mysql. and use this script:
Code:
#!/bin/bash
rm -fR /oldvhcs/var/lib/mysql/ispcp
for domain_id in `echo "SELECT domain_id FROM ispcp.domain" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
do
    uid=`echo "SELECT domain_uid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
    gid=`echo "SELECT domain_gid FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
    dmn=`echo "SELECT domain_name FROM ispcp.domain WHERE domain_id='$domain_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
    echo "===========================================================";
    echo "            $dmn";
    echo "===========================================================";
    echo "===========================================================" >&2
    echo "            $dmn" >&2
    echo "===========================================================" >&2
# process mysql
    for db_id in `echo "SELECT sqld_id FROM ispcp.sql_database WHERE domain_id='$domain_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
    do
        db_name=`echo "SELECT sqld_name FROM ispcp.sql_database WHERE sqld_id='$db_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
        for db_user_name in `echo "SELECT sqlu_name FROM ispcp.sql_user WHERE sqld_id='$db_id'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
        do
            db_user_pass=`echo "SELECT sqlu_pass FROM ispcp.sql_user WHERE sqld_id='$db_id' AND sqlu_name='$db_user_name'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s`;
            echo "grant all on \`$db_name\`.* to '$db_user_name'@'localhost' identified by '$db_user_pass'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s;
            echo "grant all on \`$db_name\`.* to '$db_user_name'@'%' identified by '$db_user_pass'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s;
        done
        cp -vR /oldvhcs/var/lib/mysql/$db_name /var/lib/mysql/
    done

# process ftp
    echo "UPDATE \`ispcp\`.\`ftp_group\` SET \`gid\`='$gid' WHERE \`groupname\`='$dmn'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s
    echo "UPDATE \`ispcp\`.\`ftp_users\` SET \`uid\`=$uid, \`gid\`='$gid' WHERE \`userid\` like '%@$dmn'" | mysql --defaults-file=/home/sci2tech/.my.cnf -s
    cp -vR /oldvhcs/var/www/virtual/$dmn /var/www/virtual/
    chown -vR vu$uid:vu$gid /var/www/virtual/$dmn
    chown -v vu$uid:www-data /var/www/virtual/$dmn
    chown -vR vu$uid:www-data /var/www/virtual/$dmn/backups
    chown -vR vu$uid:www-data /var/www/virtual/$dmn/logs
    chown -vR vu$uid:www-data /var/www/virtual/$dmn/phptmp
    chown -vR root:root /var/www/virtual/$dmn/cgi-bin

done
chown -vR mysql:mysql /var/lib/mysql
/hme/sci2tech/.my.cnf is like this:
Quote:[client]
user=root
password=MYSQLPASSWORD
I did this way becose of many mods i did to survive for 2 years with vhcs2. Maybe my way will inspire you what to do Wink
(This post was last modified: 06-11-2008 06:58 AM by sci2tech.)
06-11-2008 06:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Migrating VHCS on Ubuntu 8.04 - chrisi99 - 06-11-2008, 05:27 AM
RE: Migrating VHCS on Ubuntu 8.04 - sci2tech - 06-11-2008 06:55 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)