If your ensim accounts are on another server, go look at the "Transfer" section in your WHM and use that, it's easier! (you may have to edit usernames)
YOU MUST HAVE KNOWLEDGE OF SHELL SCRIPTS to use this information!
WARNING: Use at your own risk, do what you want with the code, have fun, add to this, change it around, post your changes, but please don't bug me to fix it.
I was using the "vhbackup" script that automatically makes ensim compatible backup .tar files daily but this should work with normal ensim created backup files.
To make this clear, this will take a ensim backup tar file and copy all the html and cgi-bin files to the proper places in the new cPanel setup.
You will need to manually create each virtual site using cPanel, then create each user if there are extra ones for the site. I also had to make a script that shows what users belong to what site. This does not move any mail files, you need to do that manually.
After that, go root (via ssh and su - of course) and do everything from a shell console.
There are two scripts, the first one will extract one sites' tar file and copy all the html and cgi stuff over to the new virtual site.
You start with the tar file(s) in the working directory you are at including the scripts, you have to change two variables at the top of the script for each new site. Again, the scripts are put in the same directory as the tar file(s) for easy access.
The next script uses my vhbackup directory containing *all* tar files for all the sites. I CD into the directory and put the script there, it simply prints out all the virtual site names, and all the users for the sites. I used this to help me create the site users again on the cpanel side. I only run it once and save the printout.
If you are confused, go look inside one of the tar files and see how things are stored by ensim, it's pretty simple.
Hope all this helps someone.
I call this one "xfer.sh":
CODE
#! /bin/sh
# The new site must be created manually in cPanel !
# hidden files like ".htaccess" will be copied for
# the public_html folder only. If sub folders have
# hidden files they are not copied, sorry, talk to redhat
# change the two variables below for each site
# username is the cpanel username for site admin
SITE1="sitename.net"
USER1="username"
# the script begins....
WHERE1="/home/$USER1"
# unpack the backup tar file "sitename.net.tar"
tar -xpvf $SITE1.tar
# unpack etc, home, and var directories into "temp"
mkdir temp
tar -xzpvC temp -f $SITE1.tgz
# remove the cpanel created .htaccess file
rm -f $WHERE1/public_html/.htaccess
# copy files out to user directories
# copy to "public_html"
cp -pR temp/var/www/html/* $WHERE1/public_html/
# copy files like .htaccess because redhat changed things
cp -pR temp/var/www/html/.* $WHERE1/public_html/
# copy to "public cgi-bin"
cp -pR temp/var/www/cgi-bin/* $WHERE1/public_html/cgi-bin/
rm -fR temp
# change the user and group recursively
chown -R $USER1.nobody $WHERE1/public_html
# The new site must be created manually in cPanel !
# hidden files like ".htaccess" will be copied for
# the public_html folder only. If sub folders have
# hidden files they are not copied, sorry, talk to redhat
# change the two variables below for each site
# username is the cpanel username for site admin
SITE1="sitename.net"
USER1="username"
# the script begins....
WHERE1="/home/$USER1"
# unpack the backup tar file "sitename.net.tar"
tar -xpvf $SITE1.tar
# unpack etc, home, and var directories into "temp"
mkdir temp
tar -xzpvC temp -f $SITE1.tgz
# remove the cpanel created .htaccess file
rm -f $WHERE1/public_html/.htaccess
# copy files out to user directories
# copy to "public_html"
cp -pR temp/var/www/html/* $WHERE1/public_html/
# copy files like .htaccess because redhat changed things
cp -pR temp/var/www/html/.* $WHERE1/public_html/
# copy to "public cgi-bin"
cp -pR temp/var/www/cgi-bin/* $WHERE1/public_html/cgi-bin/
rm -fR temp
# change the user and group recursively
chown -R $USER1.nobody $WHERE1/public_html
I call this one "list-users.sh":
CODE
#! /bin/sh
# loop through all the file names in the directory
for i in *
do
# only work on files, no directories
if [ -f $i ]
then
# remove the ".tar" part of the site name
SITE1=`echo -n $i | sed 's/.tar//'`
echo SITE: $SITE1
# unpack the backup tar file "sitename.com.tar"
mkdir -p temp
tar -xpC temp -f $SITE1.tar
if [ $? -eq 0 ]
then
# unpack etc, home, and var directories into "temp"
mkdir -p temp/temp1
tar -xzpC temp/temp1 -f temp/$SITE1.tgz
cd temp/temp1/home/
# now loop through all and list the usernames
# and the size of any inbox they may have
for x in *
do
if [ -d $x ]
then
echo -n $x
INBOX1=../var/mail/$x
if [ -f $INBOX1 ]
then
echo
ls -al $INBOX1
else
echo " (no inbox)"
fi
fi
done
cd ../../../
fi
rm -fr temp
echo
fi
done
# loop through all the file names in the directory
for i in *
do
# only work on files, no directories
if [ -f $i ]
then
# remove the ".tar" part of the site name
SITE1=`echo -n $i | sed 's/.tar//'`
echo SITE: $SITE1
# unpack the backup tar file "sitename.com.tar"
mkdir -p temp
tar -xpC temp -f $SITE1.tar
if [ $? -eq 0 ]
then
# unpack etc, home, and var directories into "temp"
mkdir -p temp/temp1
tar -xzpC temp/temp1 -f temp/$SITE1.tgz
cd temp/temp1/home/
# now loop through all and list the usernames
# and the size of any inbox they may have
for x in *
do
if [ -d $x ]
then
echo -n $x
INBOX1=../var/mail/$x
if [ -f $INBOX1 ]
then
echo
ls -al $INBOX1
else
echo " (no inbox)"
fi
fi
done
cd ../../../
fi
rm -fr temp
echo
fi
done
Now you need to work on securing your box.....