cPanel customize account transfer


Active Member
Jun 3, 2004

I'm about to migrate all my websites to another cPanel server using the "Copy multiple accounts/packages from another server" feature. The problem is, it's a big transfer and it will take a while. To prevent data rollback I want to customize the transfer process.

Basically I just want the destination server (local server) to send a signal in the form of a HTTP request to my source server (the remote server) telling the server that an account has been restored/copied. This signal will run a script that will update the DNS zones for that account with the new IP address.

What I've tried is the following. I modified /scripts/restorepkg (on the local/destination server) and added the following lines at the end:

system 'lwp-request', '' . $user;
Unfortunately though, it doesn't work. I think the /scripts/restorepkg isn't involved for restoring the account on my new server...

I've read something about this in the following presentation, which isn't really documented at all so I'm just guessing:

So my question is: Which script is used at the local/destination server to restore the account once it's copied? Is there a way to augment this script?



cPanel Development
Staff member
Apr 7, 2006
cPanel Access Level
Root Administrator
The restore process is not performed by /scripts/restorepkg, as you've surmised. To accomplish your goal you'll need to use the override feature (Allow Override) in the transfer system. On the destination server do the following:

1. copy /usr/local/cpanel/Whostmgr/ to /var/cpanel/lib/Whostmgr/ ( you might need to create /var/cpanel/lib/Whostmgr/ first )

2. In your favorite editor, modify /var/cpanel/lib/Whostmgr/

3. Add your custom code just above this line:
    $_in_transfer = 0;
    return 1;
In the copy I'm looking at that is line 1667.
4. Save the file and exit your editor

Now when you perform a transfer, make sure you select the Override checkbox in the UI.

You might need to play around with where your custom code is placed in Some errors will cause the restore process to exit before hitting your code.

p.s. I'm the same Kenneth that gave the presentation you referenced.


Well-Known Member
Aug 25, 2008
I love the last 4 slides or so. ;o
Also, regarding slide 33, neither of those options produces a demonstration!

On a more serious note one thing I noticed while customizing the account transfer functionality is that WHM seems to use an earlier version of PERL than my system uses.
/usr/local/bin/perl is version 5.8.8
The WHM run version seems to be 5.6.2

This produces an issue for me when trying to use LWP::Simple, since the pm is located in /usr/lib/perl5/site_perl/5.8.8
I tried
unshift @INC, '/usr/lib/perl5/site_perl/5.8.8/';
In the but this throws an error since that "requires 5.8.8"

To get around this I wrote the needed LWP functionality in a separate perl script and call it where I need to in
$result = `perl /path/to/myscript $domain`;

This is a manageable work around but potentially something that should be addressed.
Last edited: