cPanel-to-DirectAdmin conversion tool

this didn't work here
it generated the file but, when i tried to restore it on DA, it said it would notify me when it's ready
the .tgz has 250 MBs... right after i run the restore, i checked "top" and "gzip" was there for just 3 seconds (it needs at least 15 seconds to uncompress this file on my server)... and i didn't receive any error message
still after 20 minutes, the account wasn't create

suggestions?
 
Hello is there a fix for the pasword problem ?

After converting a user, i can login in ftp whith the old pasword but i can't not login in DA user control panel

sorry for the bad language :)

hostweb
 
Hi,

Can anyone assist me with this moving , I have around 70 clients on cpanel box and I wish to move it on DA box...

Problems :
1. I can't run /scripts/cpbackup on cp box
2. How do I configure defaults.conf

Regards,
 
I don't think it's under development anymore, perhaps if people start paying for it the developer would have time to work on it. I can't imagine it would be that hard to keep the tool up to date and I do believe a lot of folks are willing to pay a small fee for it.
 
help

we converted the accounts from cpanel to DA but account passes are not working.
what must we do?
 
we complated to transfer accounts.
everything is working.
but e-mails didnt copy.
is anyone know the reason?:confused:
 
We moved from cPanel to DA sunday, it went ok, but we had some problems. I'll describe below how we did it, and make some changes to our story, so it goes even more smooth (we had some minor problems).

First, 24 hours before you move, change all the TTL's on dns zones from 14400 (4 hours) to 900 (15 min). This is to make sure you can easily change the DNS, without a lot of waiting for your customers to use the server (and a backup getting older ;)). You can easily do this by doing the following:
1. Login to old server as root
2. cd /var/named
3. perl -pi.bak -e "s/14400/900/g" *.db
4. /etc/rc.d/init.d/named restart
source

Now, lets start getting our stuff together to move it to the new server. Because it can take a while, I suggest to start around 0.00am, so you'll be finished (depending on the transfer speed and accounts) somewhere in the morning (for us, it was finished when I got out of bed).

To get this done, you first need a list of all your users per package!. Put them on one line, like this:

Code:
user1 user2 user3 user4

Next we wrote a nice bash script for creating the accounts and moving them:

Code:
cat > backup.transfer.|PACKAGENAME|
for user in user1 user2 user3 user4
do
	/scripts/./pkgacct $user
done

for user in user1 user2 user3 user4
do
	ftp -u [url]ftp://admin:admin_pass@new_server:21/user_backups/[/url]|PACKAGENAME|/cpmove-$user.tar.gz /home/cpmove-$user.tar.gz
done
Replace |PACKAGENAME| with the packagename you are creating it for (you should have one backup.transfer per package, and a list of users owning that package). What it basicly does is first creating the backup for each user by running pkgacct, these will be stored in /home. After that it transfers the package for each user to /home/admin/user_backups/|PACKAGENAME|. Oh, and the cat > backup.transfer just creates the file to run ;).

Next chmod the files to 755:

Code:
chmod 755 backup.transfer|PACKAGENAME|
(for each pacakge-file).

You're good to go!

Setup a cronjob to excute all the files at an appropiate time. Example:
Code:
57 23 19 2 * /home/cpanel/./backup.transfer.Large >> output.txt
This cronjob will execute on 23:57 (11.57pm) on the 19th of februari. You can simply add the cronjobs by doing 'crontab -e' and put them there on a new line.

Now, we got some other work to do. We need to make sure we can restore the accounts. Because there appears to be some problem with the tool, the passwords aren't restored, and you can't restore the backups if the accounts don't exist on the DA server (sucks, yes).

What we did, is the following: we created a file with all the users on one, line, having some info with them. Like this:
Code:
username|[email protected]|domain.ext|package|password
Do this for every user, each on a line. The username is the username they will use in DA, the e-mail address is the e-mail address they will receive the mail with their info on, the domain is the domain they use for DA, and the package is the package they will use in DA (make sure it exists in DA!). We will use this in a later stage to create the accounts (btw, if you want the passwords auto generated, use this script (haven't tested it)):

PHP:
<?php
$file = "userlist.txt"; // the file with the users formated like above
$new_file = "new_userlist.txt"; // create the file in samedir as userlist.txt, and chmod it 666

$users = file($file); // grab each user-line in een array
foreach($users as $user) { // loop trough all the users
	$user = explode("|",$user);
	
	// Generate password
	$totalChar = 8; // number of chars in the password
	$salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";  // salt to select chars from
	srand((double)microtime()*1000000); // start the random generator
	$password=""; // set the inital variable
	for ($i=0;$i<$totalChar;$i++) {  // loop and create password
		$password = $password . substr ($salt, rand() % strlen($salt), 1); 
	}
	// make the new user_list
	$new_user = $user['0']."|".$user['1']."|".$user['2']."|".$user['3']".$password."\n";
	$handle = fopen($new_file, "a");
	fwrite($handle, $new_user);
	fclose($handle);
}
?>
Put this in a web-enabled dir, together with the file with the users, and use this script to rebuild it with passwords in it.

To make it even better, we also automate the creation of the user accounts! All done trough php (I'm a php freak :P). The script I wrote for this simply creates the user accounts, puts the success accounts in success.txt and the failed accounts in failure.txt (so you can create them manually). It also sends out an e-mail to your users on success, so they have the new info about their account.

You need the php API mentioned in this thread (post 4 of page 5). Put the dirs 'config' (edit the config.php in it) and 'protocol' in the same dir as the script below, together with the userlist.txt and success.txt+failure.txt (both chmodded 666).

PHP:
<?php
// some vars:
$file = "userlist.txt"; // the file with the users formated like above

// Get userinfo:
$users = file($file);

// Let's connect to DirectAdmin
include 'config/config.php';
include 'protocol/httpsocket.php';
$Socket = new HTTPSocket;

$Socket->connect($siteurl,$siteport);
$Socket->set_login($adminusername,$adminpassword);
// {admin_username} and {admin_password} are not specifically your administrative DA user,
// but rather the user that you want to own this new user.

foreach($users as $user){

	// Order userinfo
	$userinfo = explode("|",$user);
	$username 	= $userinfo['0'];
	$email 		= $userinfo['1'];
	$passwd 	= $userinfo['4'];
	$domain 	= $userinfo['2'];
	$package 	= $userinfo['3'];
	$notify 	= $no;


	// Create the account	
	$Socket->query('/CMD_API_ACCOUNT_USER',
	    array(
	        'username' => $username, // The User's username. 4-8 characters, alphanumeric
	        'email' => $email, // A valid email address
        	'passwd' => $passwd, // The User's password. 5+ characters, ascii
	        'passwd2' => $passwd, // Password double check. 5+ characters, ascii
	        'domain' => $domain, // A valid domain name in the form: domain.com
	        'package' => $package, // One of the User packages created by the Reseller
	        'ip' => $ipaddress, // One of the ips which is available for user creation. Only free or shared ips are allowed.
	        'notify' => $notify, // yes or no. If yes, an email will be sent to email
	        'action' => 'create',
	        'add' => 'Submit'
	    ));
	$result = $Socket->fetch_parsed_body();
	
	if ( $Socket->get_status_code() != 200 || !empty($result['error']) ) {
		// Failure
		$handle = fopen("failure.txt", "a");
		fwrite($handle, $username."|".$email."|".$domain."|".$package."|".$passwd."|".$result['text']."|".$result['details']."\n");
		fclose($handle);
		echo $handle, $username."|".$email."|".$domain."|".$package."|".$passwd."|".$result['text']."|".$result['details']." FAILED <br />";		

	} else {
		echo $handle, $username."|".$email."|".$domain."|".$package."|".$passwd."|".$result['text']."|".$result['details']." SUCCESS <br />";
// Message to e-mail on success:	should contain at least the new password: $passwd, please escape double quotes like this: \"
$subject = "Your account is moved";
$message = "Dear Customer,

We succesfully moved you to the new server, your account settings will be restored within a few minutes.

Your account information:
DirectAdmin URL: [url]http://[/url]".$domain."/config.
DirectAdmin Password: ".$passwd.".
DirectAdmin username: ".$username."


With best regards,

Some hosting-company ([url]www.somecompany.com[/url])";

		// Success
		$handle = fopen("success.txt", "a");
		fwrite($handle, $username."|".$email."|".$domain."|".$package."|".$passwd."|".$result['text']."|".$result['details']."\n");
		fclose($handle);
		mail($email, $subject, $message,
		"From: [email][email protected][/email]\r\n" .
		"Reply-To: [email][email protected][/email]\r\n" .
		"X-Mailer: PHP/".phpversion());
	}
}

?>

We're all set, what do we have?

- A cronjob backing up all your accounts and ftp'ing them over to your new server.
- A phpscript + the needed info to create all the accounts.
- The cpanel->da tool somewhere working on your server (not covered in this post, but you're reading this thread, so I assume you have it).

Now it's time to test, if you haven't done so already. Pick a few customers to test with (they will few 'special' if you choose them as beta-tester), or try it with a few accounts of your own. Everything is working? Good, then it's time to start on the big move. Exciting!

The backup + ftp proccess is fully automatic, and when it's done, you put the first batch of users in the import dir (you convert them per package). Set up your default.conf (change the package) and start converting them. When it's finished, move the contents of the export dir to /home/admin/user_backups and move the contents of import to /home/admin/cpanel_|PACKAGE| (I suggest you keep the backups for a while). Do this for every package+user and you should have all the backups converted in your /home/admin/user_backups dir.

Now it's time to inform the users about their new home being ready. Run the php script which creates the accounts. Once it's finished, you log on to DirectAdmin, go to the Reseller part, to the backup-part and select all the backups to restore.

Change the old server to point to the new server, so all the users will use the new server in 15 minutes:

1. Login to old server as root
2. cd /var/named
3. perl -pi.bak -e "s/[oldip]/[newip]/g" *.db
4. /etc/rc.d/init.d/named restart
source

That's it, the move is done!

Now, this sounds cool of course, but there are some things not working after moving from cpanel to DirectAdmin. I would suggest to inform your users about it. The following problems occured with us:

- Spam Assassin settings disappeared.
- Addon domains didn't work too well all the time (you can see wether a problem with an addon domain will show up, if you see an error while converting the package).
- Parked domains: the same, sometimes they didn't get moved.
- MySQL users: if a MySQL user in cPanel is moved for multiple databases, it will only work for one database.
- FTP Accounts: sometimes these didn't get moved either (not sure wether they didn't move at all).
- Cronjobs: nope, couldn't get these converted to DirectAdmin.
- Mailing lists: same as with the cronjobs.
- E-mail forwarders: didn't convert either (normal inboxes did move, w/out the mail tho).
- Autoresponders: same as e-mail forwarders.
- Catch-all (default address) settings: must be set again by the user, if it was customized.

Any questions or suggestions? Post them below :-).

Jochem

//edit: fixed some typo's.
 
Last edited:
1. Login to old server as root
2. cd /var/named
3. perl -pi.bak -e "s/[oldip]/[newip]/g" *.db
4. /etc/rc.d/init.d/named restart

I am a complete newbie to ssh and linux command. Please do tell me what does these lines do. I got really freak out, when I enter the 3rd line and a whole page of "can't rename" appear. :( I am kind of stuck now thinking should I be continuing the 4th line (hand shaking now :().

I am a reseller of another hosting company and I don't want to be responsible crashing their server :(
 
Last edited:
dxoxb said:
I am a reseller of another hosting company and I don't want to be responsible crashing their server :( [/B]
Login to old server as root
Since you're reseller, you don't have root permissions and that way, you aren't able to edit the zones. You need to edit the zones by hand, replacing the old IP with the new one... we've done this on another server, 6 months ago or something. Yes, it sucks.

Jochem
 
That's really fast respond XBL :)

Ok, now I am totatlly convince that I should not do this transfering stuff. (probably manually). anyway I think it is way too difficult for newbie at this point of the development.

But appreciate this work :)
 
You must have some basic knowledge of running a server, commandline and a bit of php (at least know what's going on).

If you don't have a lot of accounts, it certainly better to do it manually, because there are some bugs in the backup conversation. But after +/- 40 accounts it's too much work to do it manually, imo. We had to move around 170 accounts...

Jochem
 
Probably that is why I hv been a reseller all this while. I have close to zero knowledge of running a server :P and I got about 300 domain name to transfer :P

I guess I am going to be stuck with my hosting company for a while (hopefully not too long) and really hope that this transfer stuff can be a standard feature in DA. I probably get another license if this is happening. :)
 
I've root access with SCP to a existing Cpanel server. Any chance that I can migrate some user account over? if yes where can I look out for them?
 
dxoxb said:
I've root access with SCP to a existing Cpanel server. Any chance that I can migrate some user account over? if yes where can I look out for them?

You run the tool on the backup files from your old server. It's not a direct migration method. You have to do some work for it to work.

Do note that the username and password must be the same on both boxes. Also received emails do not transfer.

-drmike
 
i'm looking for help

hello, i'm new here, i'm looking for urgent help moving accounts, i'm trying and getting errors, if some one knows how to do it please pm me, i pay, thanks.
 
Back
Top