hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Web Hosting Talk Tutorials : Hosting Software and Control Panels Tutorials : directadmin to cpanel : a partial BASH solution
Reply

Forum Jump

directadmin to cpanel : a partial BASH solution

Reply Post New Thread In Hosting Software and Control Panels Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 10-25-2004, 01:41 PM
skyhorse skyhorse is offline
New Member
 
Join Date: Oct 2004
Posts: 4

directadmin to cpanel : a partial BASH solution


Hi,

I'm one of those who spent hours moving from DirectAdmin to cPanel, and in the meantime I've developed a couple of usefull tools to help me do it.

For the sanity of everyone ever trying to achieve this, forget googling because there is no tool available ATM. No one has ever started a script simply because the transition from DA to CP are so different that it is unthinkable.

There are scripts to move from cPanel to DirectAdmin though

I've started a BASH script that basically takes the files already available under the directories "backup" and "domains", puts them nicely under one directory and tar-gzips it all. (the backup and domains directories come from untaring the User Backup created under DirectAdmin)

you then have to upload the resulting tar-gzip to the newly created cPanel account and untar-zip it. The file manager in cPanel does this with a click.

this script still has LOADS of problems, and if you're unexperienced with the linux FS, permissions, etc... don't come this way

What this does, however, is saving a lot of time if the accounts in question have many e-mails accounts (I did this because some of my clients had 100+ emails), and also takes care of the user files (public_html and everything else)

Resuming, this is what the script does:

- copy the quota file
- copy the IMAP folders and inbox folder of the main account
- copy the squirrelmail settings
for EACH e-mail account it does this:
- generate the entry and update the shadow and passwd file with its username and password (you keep everyone's passwords!)
- copy the IMAP folders and inbox to the respective directory

to the domain files, it does this also:
- update references in every file (php, html, etc) by removing "domains/domain.net"
(ie /home/skyhorse/domains/skyhorse.org/public_html becomes /home/skyhorse/public_html)

This does not handle FTP settings, subdomain settings, dns settings, or anything else.
But hey, it saved me hundreds of hours of pain...

It is easily improved, so if you do, please send it back to me

BTW, the scripts assumes you're using the SAME username in directadmin and in cpanel for each account, and the same domains as well.
It is also

It can also take a bit of hard disk space, since it literally duplicates the accounts files. If this is an issue, script around it to use the /tmp directory or even better, do some pipelining with tar

One last thing, although you see the CHMOD command being used, when untaring all files loose the damn permissions.
you NEED to change the permissions manually (inbox NEEDS to be group writable) or find a way to resolve the issue, which I couldn't.

here it is anyway, remember to replace the variables with your own settings:

# bash
# Copyleft (C) SkyHorse 2004
# for each account:
# put passwd as passwd + shadow
# quota (if != 0)
# into ~/etc/%domain%
GENDOMAIN=domain.com
GENUSERNAME=accuser
NEWACCPASS=accpass
MYFILESPATH=/home/skyhorse/temp_sites


mkdir result
mkdir result/mail
mkdir result/mail/$GENDOMAIN
mkdir result/etc
mkdir result/etc/$GENDOMAIN

cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/quota result/etc/quota
chmod 644 result/etc/quota

touch result/etc/shadow
chmod 640 result/etc/shadow

touch result/etc/passwd
chmod 644 result/etc/passwd

chmod 660 $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/*
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/imap/* result/mail
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/pop/$GENUSERNAME result/mail/inbox
chmod 660 result/mail/inbox

mkdir result/.sqmaildata
cp $MYFILESPATH/$GENUSERNAME/backup/email_data/squirrelmail/* result/.sqmaildata

ENTRY=`cat $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/passwd`
for line in $ENTRY
do
login=`echo $line | sed s/[:].*//`
pass=`echo $line | sed s/.*[:]//`
mkdir result/mail/$GENDOMAIN/$login
mkdir result/mail/$login

echo $login:x:32120:622::/home/$GENUSERNAME/mail/$GENDOMAIN/$login:/usr/local/cpanel/bin/noshell >> result/etc/passwd
echo $login:$pass::::::: >> result/etc/shadow

chmod 750 result/mail/$GENDOMAIN/$login
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/pop/$login result/mail/$GENDOMAIN/$login/inbox
chmod 660 result/mail/$GENDOMAIN/$login/inbox

cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/.mailboxlist result/mail/$GENDOMAIN/$login/
cp $MYFILESPATH/$GENUSERNAME/backup/$GENDOMAIN/email/data/imap/$login/mail/* result/mail/$GENDOMAIN/$login/

touch result/mail/$login/inbox
chmod 660 result/mail/$login/inbox
done

cp result/etc/* result/etc/$GENDOMAIN/


#domain files
cd domains/$GENDOMAIN
#update file references - this one liner deletes domains/domain.net in every file of the tree.
# efectively changes:
#/home/username/domains/domain.net/public_html into
#/home/username/public_html
find ./ -type f -exec sed -i 's/domains\/$GENDOMAIN\///' {} \;

cp -R * ../../result
cd ../../result

tar --owner=$GENUSERNAME --group=$GENUSERNAME -czf ../$GENUSERNAME-$GENDOMAIN.tar.gz *
cd ..

#upload tar.gz
#I have ncftpput installed, but because most people don't, I've commented it out
#ncftpput -u $GENUSERNAME -p $NEWACCPASS localhost / $GENUSERNAME-$GENDOMAIN.tar.gz


#database:

#mysql

#subdomains

#ftp



Sponsored Links
  #2  
Old 10-20-2007, 03:50 PM
InceptionGS InceptionGS is offline
Newbie
 
Join Date: Oct 2006
Posts: 10
Is there some automated script or converter already available? Current web search has not revealed anything. Thank you.

__________________
Sincerely,

InceptionGS
Cheap web hosting solutions

  #3  
Old 10-30-2007, 08:32 PM
supportoncall supportoncall is offline
Temporarily Suspended
 
Join Date: Oct 2007
Posts: 106
Hello,

Thanks for the script , are you sure that its gonna work.
Just trying to use it now needs to confirm.

Sponsored Links
  #4  
Old 10-31-2007, 06:20 AM
eDedi eDedi is offline
Web Hosting Master
 
Join Date: Feb 2005
Location: London, England
Posts: 963
Thanks for the script , Il give it a test later on and post if it works

__________________
Jon Black

  #5  
Old 12-10-2007, 08:32 PM
MrTrip MrTrip is offline
Newbie
 
Join Date: Jul 2007
Posts: 5
Quote:
Originally Posted by InceptionGS View Post
Is there some automated script or converter already available? Current web search has not revealed anything. Thank you.
I couldn't find anything...

And so far this script is a failure....VERY out dated now.


Has ANYBODY found anything new? Or used anything new?

  #6  
Old 12-11-2007, 12:04 PM
cPanelDavidG cPanelDavidG is offline
Web Hosting Master
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 563
Quote:
Originally Posted by MrTrip View Post
I couldn't find anything...

And so far this script is a failure....VERY out dated now.


Has ANYBODY found anything new? Or used anything new?
In the latest EDGE, CURRENT and RELEASE builds of cPanel 11, a DA to cPanel migration script is included. DirectAdmin to cPanel migrations are also now included in our free Transfer Assistance Program.

__________________
David Grega
cPanel Technical Product Specialist

  #7  
Old 12-11-2007, 02:48 PM
MrTrip MrTrip is offline
Newbie
 
Join Date: Jul 2007
Posts: 5
Quote:
Originally Posted by cPanelDavidG View Post
In the latest EDGE, CURRENT and RELEASE builds of cPanel 11, a DA to cPanel migration script is included. DirectAdmin to cPanel migrations are also now included in our free Transfer Assistance Program.
I'm working with Robert right now to get the email accounts to transfer properly with pkgacct-da.

I love cPanel

  #8  
Old 12-13-2007, 02:08 AM
@Matt @Matt is offline
Web Hosting Master
 
Join Date: Jan 2003
Location: U.S.A.
Posts: 3,911
I tried the tool out in cPanel and could not get it to work.

  #9  
Old 12-13-2007, 10:16 AM
MrTrip MrTrip is offline
Newbie
 
Join Date: Jul 2007
Posts: 5
Quote:
Originally Posted by Matt.G View Post
I tried the tool out in cPanel and could not get it to work.
Update your cPanel build. The latest EDGE has a fix for the problem that I was having.

Plus, one of the techs worked with me on updating the pkgacct-da script, so if you want I can post the one I have, it solved some email transfer problems for me.

  #10  
Old 02-10-2008, 12:12 PM
linuxperts linuxperts is offline
Web Hosting Evangelist
 
Join Date: Jul 2004
Posts: 509
Hi,

Wow Cpanel has a DA transfer script!

How does it handle DA resellers and their user accounts?

__________________
OSHS Ltd
OSHS Services - DNS Clusters | R1Soft Licenses | Remote Backup Storage | R1Soft CDP Storage | Cheap Dedicated Servers
EconDC.com - New London DC with Cheap Server Colo & Rack Space (launching 15th May 2012)


  #11  
Old 08-18-2008, 05:19 PM
josedavidbravo josedavidbravo is offline
Newbie
 
Join Date: Aug 2008
Location: Colombia
Posts: 12
Problem with emails

Hi, I tried the cPanel migration tool, it created the email accounts in the new cPanel account, but it didn't transfer the emails.

Anyone know can I solve this problem?

Thanks,

<<Signature to be setup in your profile>>


Last edited by anon-e-mouse; 08-18-2008 at 06:22 PM.
  #12  
Old 08-18-2008, 05:42 PM
cPanelDavidG cPanelDavidG is offline
Web Hosting Master
 
Join Date: Nov 2006
Location: Houston, TX
Posts: 563
Quote:
Originally Posted by josedavidbravo View Post
Hi, I tried the cPanel migration tool, it created the email accounts in the new cPanel account, but it didn't transfer the emails.

Anyone know can I solve this problem?

Thanks,

<<Signature to be setup in your profile>>
I know our QA team has been working on some recent improvements in the transfer script to handle email issues. You are making use of the free Transfer Assistance Hotline, correct? If so, our QA team is likely already working with you on resolving this issue.

__________________
David Grega
cPanel Technical Product Specialist


Last edited by anon-e-mouse; 08-18-2008 at 06:22 PM.
  #13  
Old 08-18-2008, 05:50 PM
josedavidbravo josedavidbravo is offline
Newbie
 
Join Date: Aug 2008
Location: Colombia
Posts: 12
Hi David,

I I submited a few hours ago a ticket requesting help for transfering account from DA to cPanel.

Thanks,

Reply

Related posts from TheWhir.com
Title Type Date Posted
cPanel Releases cPanel, WHM 11.34 with New User Interface Web Hosting News 2012-10-16 13:09:49
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02
CloudLinux Releases New LVE Manager Control Panel Plugin Web Hosting News 2012-09-04 10:36:10
Video: cPanel and Attracta Talk About Integrating SEO Tools into the Hosting Control Panel Whir Tv 2013-10-05 05:55:56
GlobalSign OneClickSSL Plug-in Available with DirectAdmin Web Hosting Control Panel Web Hosting News 2012-08-02 14:21:17


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?