Auto import cPanel sites to CyberPanel

v1.8.5 and aboves provides you with utility to automatically import cPanel accounts to CyberPanel. To use this feature you need to download/upload backups to your server in any location such as /home/backup.

Once backups are downloaded execute this command to restore them:

/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/cPanelImporter.py --path /path/to/files

This is not the path of a certain backup file, it is a path of folder which contain cPanel .tar.gz files. All cPanel backups files will be restored found in the given path.


Debugging restore issues

When you start the restore action, first thing it will do is output the log file. Now if something goes wrong you can use that file to see what have gone wrong.

cat /log/file | grep Failed

4 Likes

hello, ive tried to restore a cpanel backup using the py command and this is what i received from the log file:

> root@cronuswo-eu:/# /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/cPanelImporter.py --path /home/backup
> 
> Backup logs to be generated in /home/cyberpanel/3684
> cronusw0
> root@cronuswo-eu:/# 
> root@cronuswo-eu:/# cat /home/cyberpanel/3684Extracting main cPanel archive file: /home/backup/cpmove-cronuswo.tar.gz
> /home/backup/cpmove-cronuswo.tar.gz successfully extracted.
> Creating main account from archive file: /home/backup/cpmove-cronuswo.tar.gz
> Detected main domain for this file is: domain.com.
> Finding PHP version for domain.com.
> PHP version of domain.com is PHP 7.4.
> Finding Server Admin email for domain.com.
> Server Admin email for domain.com is [email protected].
> Calling core to create domain.com.
> Websites matching query does not exist.
> Failed to create main site domain.com from archive file: /home/backup/cpmove-cronuswo.tar.gz

ive restored a previous backup once and it worked and there are websites, domains and databases already created

this backup is newer and im restoring again but im getting a failed for some reason

please help

what is output of cat /home/cyberpanel/3684

1 Like

all figured out
the script couldnt auto import but when i removed all the domains, websites, databases it started importing no problem
it just doesnt work when there is already stuff there

What backup type does it support? Does it also support Jetbackup backup files? Thanks

Does this work with cp-move backup method?

Does it need to be compressed? Is incremental backup okay?

The autoimport does not start.

Backup logs to be generated in /home/cyberpanel/8686

nothing is generated, the log files does not exist.

we took full account backup at cPanel. file format is tar.gz , we uploaded file to home/backup path. after used your autoimport code. log saying this “Websites matching query does not exist.” how we will fix this?

we did not create any website database or other stuff. only started import. log file creating. archive opening to folder but import not working

@usmannasir could u check?

hello again. I checked CyberPanel source codes and find a bug.
“createVirtualHost” method sending package parameter “Default”
if u deleted or changed default package, import not working.
Also logs dont saying this error message.

@usmannasir please add error message to source code logs, or dont send default parameter. save packages in a list and send package list index (forexample [0]) or create automaticly Default package.

if u fix your error with this message please write a thx message =)

We’ve tried to perform this migration and have run into some issues. The major issue is that this migration script does not create a user in cyberpanel. The restored account just go under admin. How do we fix this?

Good evening
Thanks for the information I followed your explanation and yesterday I managed to migrate automatically 7 websites with the wordpress and the email accounts.
But today I am trying to do the same with 2 sites that I missed and the system throws this error that I leave you here below.

root@SRV-KOET00-005:~# /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/cPanelImporter.py --path /home/backup
Backup logs to be generated in /home/cyberpanel/4553
root@SRV-KOET00-005:~# cat /log/file | grep Faile
cat: /log/file: No such file or directory
root@SRV-KOET00-005:~#

Hello, I wanted to ask the following question, I have some emails in cpanel that I want to migrate to cyber panel, I already made the accounts in cyber panel and I need to pass the inbox and outbox nothing else, is there a way to do it? I just need to migrate the emails from my old hosting account to the new one from cyberpanel

Hi,

I’m trying to restore a cPanel full backup user account on fresh install of CyberPanel v2.3 and I get this error:

Failed to create main website from backup file /home/backup/user.tar.gz, error message: list index out of range.

Any ideas what may be wrong here?

Run upgrade script and try again

After complete migrate from cpanel should i delete cpanel backup folder from server?

Migration Steps cPanel to CyberPanel (One or More Sites)

  1. cd /home/
  2. mkdir backup
  3. Upload .tar.gz in /home/backup folder or wget https://…/backup.tar.gz
  4. /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/cPanelImporter.py --path /home/backup/

That’s it.

Hello, mate. Will this also import the emails properly? Thanks

For me, what resolved this error was to rename the file from backup-<date>_<time>_<account>.tar.gz to <account>.tar.gz.

The importer tries to load a JSON file from a directory called backup-<date>_<time>_<account> rather than what it actually extracts as, which is just <account>.

For that reason, renaming the file to what the directory extracts as ahead of time resolved the “list index out of range” error for me.

EDIT: The “real” backup I just took actually wanted to extract as backup-<date>_<time>_<account>, so you need to adjust your strategy in order to avoid this error.

I was facing the same issue when trying to restore a cPanel full backup user account on a fresh install of CyberPanel. It turns out the cyberpanel command for restoring was unpacking the archive and using the archive name as it appeared to access the backup which led to the error as it was not finding that directory.

I realized that when I backed up in cPanel, it might have given a different name to the final archive that was not the same as the initial file. for instance, my backup before archiving was mboshoco after archiving it became mboshoco_7-23-2024.tar.gz so the command for restoring was using mboshoco_7-23-2024 instead of mboshoco.

So I renamed the backup before archiving and after archiving and it solved my issue