cPanel-to-DirectAdmin conversion tool

Lol, I had just grabbed the .93 version a couple hrs before this post, and was having major issues with it and about to post back here! Thanks Phil!
 
Perfect..!!!

Hi there,

Yes I have just used it to transfer an account from cpanel server to directadmin server and it worked perfectly for me.

Fantastic Job!!

Sushant
 
Check your webmail setup. I used this script 1 year ago and my mailbox formats have never been correct.
 
Creating DirectAdmin tarball...
Cleaning up...
Success!

1 tarballs attempted/converted.

~fin.



1000 thanks . ;)
 
Failed restore

I just tried this script, but got an error on restore...
-------------
Creating DirectAdmin tarball...
Cleaning up...
Success!

1 tarballs attempted/converted.
-------------
admin@sea:~/user_backups$ ls -l
total 229756
-rw-r--r-- 1 admin admin 235030602 Mar 25 02:59 tom.tar.gz
-------------
Error during Restore

Details


--------------

DA didn't give any details about the error, so I'm not sure where to go from here. Any ideas?
 
It's not Directadmin failing to give the details, it's the script.

Which script? It's the DA Restore User Backup function that is failing and giving no details. If I knew where the restore script was failing, I could fix that section of the conversion script.

Personally, I've not been able to use this script in nearly a year after the Cpanel code changes.

I'm using cPanel 11.24.4-RELEASE 34599 and da.cpanel.import.9.4. What are the known issues/compatibility of these versions?
 
Last edited:
Error during Restore

Details

It seems the source of this error was a bad task.queue that wasn't cleared because cron was not installed! Fresh install and it hadn't crossed my mind that cron wouldn't be installed--they must have given me a super minimal image.

Anyway, this script is working fine now. I'm rather impressed; it transferred passwords and all.

Edit: Mail forwarders did not automatically transfer. Haven't found any other issues yet.
 
Last edited:
I wrote a patch to add email forwarders transfer feature:

Code:
--- da.cpanel.import.pl	2009-01-13 14:13:37.000000000 -0800
+++ da.cpanel.import.mine.pl	2009-03-25 15:03:52.000000000 -0700
@@ -428,8 +428,33 @@ $domain.     14400   IN      MX      0 $
 
 		print "($mail_count converted)$mail_list";
 
+		# Copy mail forwarders
+		print("\n\t\tAliases/Forwarders converted... ");
+		my @va;
+		my @alias;
+		my $alias_count = 0;
+
+		# Open cPanel aliases file and save in array
+		open(VAFILE, "${ROOT_PATH}import/$incoming_user/va/$domain");
+		@va = <VAFILE>;
+		close(VAFILE);
+
+		# Create DirectAdmin aliases file, convert aliases,
+		# and append to DirectAdmin aliases file
+		open(DAALIASES, ">${ROOT_PATH}export/$incoming_user/backup/$domain/email/aliases");
+		foreach $line (@va)
+		{
+			if ( $line=~/\@$domain: / )
+			{
+				@alias = split(/\@$domain: /,$line);
+				print DAALIASES $alias[0] . ":" . $alias[1];
+				$alias_count++;
+			}
+		}
+		close (DAALIASES);
+		print("($alias_count converted)");
+
 		# create some empty files (to keep DA from croaking)...
-		open GH, ">${ROOT_PATH}export/$incoming_user/backup/$domain/email/aliases"; close GH;
 		open GH, ">${ROOT_PATH}export/$incoming_user/backup/$domain/email/autoresponder.conf"; close GH;
 		open GH, ">${ROOT_PATH}export/$incoming_user/backup/$domain/email/vacation.conf"; close GH;
 		open GH, ">${ROOT_PATH}export/$incoming_user/backup/$domain/email/email.conf"; close GH;

Disclaimer: I don't know Perl. This was my first experience, but it seems to work quite well.
 
Last edited:
The following I'm trying the cpanel to da conversion tool.

The import and export folders are in /root.
The da.cpanel.import.pl is also in /root.

But when I execute the da.cpanel.import.pl in my shell it asks a few things and I get:

Checking for ./import/... FAILED

What did I do wrong or didn't do?
 
Code:
[root@da ~]# ls -l /root
total 72
-rw-r--r-- 1 root root 21171 Apr  6 20:11 da.cpanel.import.pl
-rw-r--r-- 1 root root   267 Apr  6 20:01 defaults.conf
drwxr-xr-x 2 root root  4096 Apr  6 21:58 export
drwx--x--x 2 root root  4096 Apr  6 21:58 import
-rwxr-xr-x 1 root root 33439 Apr  4 22:33 setup.sh
[root@da ~]#
 
Code:
#!/usr/bin/perl
use strict;
use vars qw( $VERSION $ROOT_PATH );

$VERSION = '.9.4';
$ROOT_PATH = './';

&main;

That is my first piece of the code.

Edit:

Tried it the same way on my cpanel server now and there it worked the first time, it's converting as we speak.
Maybe had something to do with the scp of the import folder i did.
 
Last edited:
Help!

I have tried countless times to get my rather large cpanel complete backup to migrate over to a DA backup. I have looked over countless details and am still having issues. If someone could possible help me it would be appreciated. I get to the point that it is working on the server but keeps giving an error and will not complete. Is there something special I need to have setup on cpanel so that it will match something on the DA server?



Examining backup-5.9.2009_09-48-04_lhent.tar.gz...
Fround user lhent..tar: backup-5.9.2009_09-48-04_lhent/homedir.tar: Wrote only 1024 of 10240 bytes

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
.
Switching to lhentertainment.net...
Collecting subdomains...
testing.lhentertainment.net
my.lhentertainment.net
Building DNS...
Processing FTPs...
Collecting pop3 addresses...
Copying remaining files... mv: cannot stat `./import/lhent/homedir/public_html': No such file or directory

Creating domain pointers...
Translating any Crontab entries... 0 total..
Dumping databases...
Creating DirectAdmin tarball...
Cleaning up...
Success!

1 tarballs attempted/converted.

~fin.
 
I have tried countless times to get my rather large cpanel complete backup to migrate over to a DA backup. I have looked over countless details and am still having issues. If someone could possible help me it would be appreciated. I get to the point that it is working on the server but keeps giving an error and will not complete. Is there something special I need to have setup on cpanel so that it will match something on the DA server?



Examining backup-5.9.2009_09-48-04_lhent.tar.gz...
Fround user lhent..tar: backup-5.9.2009_09-48-04_lhent/homedir.tar: Wrote only 1024 of 10240 bytes

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
.
Switching to lhentertainment.net...
Collecting subdomains...
testing.lhentertainment.net
my.lhentertainment.net
Building DNS...
Processing FTPs...
Collecting pop3 addresses...
Copying remaining files... mv: cannot stat `./import/lhent/homedir/public_html': No such file or directory

Creating domain pointers...
Translating any Crontab entries... 0 total..
Dumping databases...
Creating DirectAdmin tarball...
Cleaning up...
Success!

1 tarballs attempted/converted.

~fin.

Try to rename the file to: lhent.tar.gz and then run the process.
Use Reseller level backups and process them. Not the user level.
 
reseller level backup

Where in the cpanel/whm do I locate the reseller level backup option?
 
Back
Top