Page 2 of 2 FirstFirst 12
Results 21 to 35 of 35

Thread: Feture request, cpanel backup to directadmin backup.

  1. #21
    Join Date
    Jul 2017
    Location
    Murfreesboro
    Posts
    16
    Oh I am sure you all have something like this. here is a loop to make cpmoves on the entire CPANEL box.
    Code:
    grep root /etc/trueuserowners | cut -d : -f 1 | while read a; \
    do /usr/local/cpanel/scripts/pkgacct $a; \
    done
    Thanks,

    Brent Dacus

  2. #22
    Join Date
    May 2008
    Posts
    33
    After some problems I got this script working, some comments to be aware if you have problems with the generated file:

    The NS1 and NS2 needs to be globally defined, are used in the DNS functions but to generate the user.conf file too:

    You can add this to the top of the file or after "#Generate user.conf"
    Code:
    NS1="`/usr/local/directadmin/directadmin c | grep -m1 '^ns1=' | cut -d= -f2`"
    NS2="`/usr/local/directadmin/directadmin c | grep -m1 '^ns2=' | cut -d= -f2`"
    Another problem was this error

    Code:
    Named::writeDB: error writing zone for domain.tld: email='' or ns1='' is empty. Ensure the zone is not corrupted.
    If you the dns file generator section you will see

    Code:
            #Create DNS zone
            CONVERTED_DOMAIN_DNS="${DIRECTADMIN_BACKUPS}/${USERNAME}/backup/${CONVERTED_DOMAIN}/${CONVERTED_DOMAIN}.db"
            CPANEL_DNS_DATA=${DIRECTADMIN_BACKUPS}/${USERNAME}_cpanel_to_convert/dnszones/${CONVERTED_DOMAIN}.db
            if [ -s ${CPANEL_DNS_DATA} ]; then
            cp -f ${CPANEL_DNS_DATA} ${CONVERTED_DOMAIN_DNS}
            else
    And with this the DNS zone is done, but the cpanel dns file isn't compatible with the directadmin backup script a needs to be fixed, my suggestion:

    add below
    Code:
    cp -f ${CPANEL_DNS_DATA} ${CONVERTED_DOMAIN_DNS}
    This

    Code:
                    sed -i '/domainkey/d' ${CONVERTED_DOMAIN_DNS}
                    sed -i '/NS/d' ${CONVERTED_DOMAIN_DNS}
                    sed -i '/SOA/d' ${CONVERTED_DOMAIN_DNS}
                    sed -i "/\$TTL/a@       IN      SOA     ${NS1}.      hostmaster.${CONVERTED_DOMAIN}. (" ${CONVERTED_DOMAIN_DNS}
                    echo "${CONVERTED_DOMAIN}.     14400   IN      NS      ${NS1}." >> ${CONVERTED_DOMAIN_DNS}
                    echo "${CONVERTED_DOMAIN}.     14400   IN      NS      ${NS2}." >> ${CONVERTED_DOMAIN_DNS}
    With comments:

    The cpanel domainkey isnt compatible with directadmin, not need here:
    sed -i '/domainkey/d' ${CONVERTED_DOMAIN_DNS}
    We need to update the NS servers of the zone to our local, for this, the NS records of cpanel needs to be removed.
    sed -i '/NS/d' ${CONVERTED_DOMAIN_DNS}
    The cpanel SOA starts with the domain name, in directadmin needs to be @ or the import fail, for this we remove the line:
    sed -i '/SOA/d' ${CONVERTED_DOMAIN_DNS}
    Add the new SOA line to the zone:
    sed -i "/\$TTL/a@ IN SOA ${NS1}. hostmaster.${CONVERTED_DOMAIN}. (" ${CONVERTED_DOMAIN_DNS}
    Add the new NS records to the zone:
    echo "${CONVERTED_DOMAIN}. 14400 IN NS ${NS1}." >> ${CONVERTED_DOMAIN_DNS}
    echo "${CONVERTED_DOMAIN}. 14400 IN NS ${NS2}." >> ${CONVERTED_DOMAIN_DNS}

    I think more things can be done with this, but now the zone is compatible with directadmin

    For alias/pointers domains you need to fix it too:

    After this

    Code:
    cp -f ${CPANEL_POINTER_DNS_DATA} ${CONVERTED_POINTER_DNS}
    Add

    Code:
                    sed -i '/domainkey/d' ${CONVERTED_POINTER_DNS}
                    sed -i '/NS/d' ${CONVERTED_POINTER_DNS}
                    sed -i '/SOA/d' ${CONVERTED_POINTER_DNS}
                    sed -i "/\$TTL/a@       IN      SOA     ${NS1}.      hostmaster.${i}. (" ${CONVERTED_POINTER_DNS}
                    echo "${i}.     14400   IN      NS      ${NS1}." >> ${CONVERTED_POINTER_DNS}
                    echo "${i}.     14400   IN      NS      ${NS2}." >> ${CONVERTED_POINTER_DNS}
    Another detail, the NS2 variable in the DNS Zone section is using the NS1 data:

    Code:
    NS2="`/usr/local/directadmin/directadmin c | grep -m1 '^ns1=' | cut -d= -f2`"
    Fix to

    Code:
    NS2="`/usr/local/directadmin/directadmin c | grep -m1 '^ns2=' | cut -d= -f2`"


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

    A question, when a cpanel backup dont have a DNS zone?

    if [ -s ${CPANEL_DNS_DATA} ]

    I think, the "else" section never will be executed because the cpmove file always have the main domain dns zone.

    For the pointers is the same situation "if [ -s ${CPANEL_POINTER_DNS_DATA} ];" , if a pointer exist, you will have a DNS file from the cpmove, and based on this the "else" section never will be executed.

    After all now the script is working thanks smtalk for your script.

    Regards
    Roberto

  3. #23
    Join Date
    Apr 2013
    Posts
    25
    i have error in mysql like this
    Code:
     set_collation: DB farapajo_farapajo_dnppoaO0HreTp7IL does not have any collation information in the backup. Skipping

  4. #24
    Join Date
    Apr 2013
    Posts
    25
    some other error in email
    Code:
     Error writing db file for siminsepahan.com : The email or the ns1 value is blank.  Check to ensure the zone isn't corrupted

  5. #25
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,803
    Thank you for the reports! Updated version to 0.0.4 with bugfixes for reported problems
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  6. #26
    Join Date
    May 2008
    Posts
    33
    Quote Originally Posted by smtalk View Post
    Thank you for the reports! Updated version to 0.0.4 with bugfixes for reported problems
    Hi smtalk,
    Just still a small bug(or not?), the NS records on the DA converted zone still use the cpanel records, I think this records needs to be change for the DA default ones.

    Thanks
    Regards

  7. #27
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,803
    There is a checkbox in DA admin backup/transfer for that: "Restore with Local NameServers. (unchecked: Use NS values from backup)". If it's checked, it should overwrite NS to the ones used on DA server.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  8. #28
    Join Date
    Dec 2017
    Posts
    4

    How to use This Script?

    Quote Originally Posted by smtalk View Post
    cPanel backup conversion tool BETA is now ready I'm attaching it to the reply.

    Differences between this tool and the one that is already on DA forums:
    1. Script transfers resellers and their packages.
    2. Script transfers subdomain/domain data from custom folders.
    3. Email forwarders get transferred.
    4. MX records in DNS zones get transferred.
    5. RoundCube data gets transferred (optional, requires additional scripts)

    There might be more differences between the scripts, but these are the most obvious ones

    Known issues:
    * cPanel mdbox format email transfer has not been tested
    * Mailman mailing lists do not get converted to majordomo mailing lists

    Please let us know if you notice anything with your transfers

    Cpanel to DA backup conversion script URL http://www.custombuild.eu/cpanel/cpanel_to_da.sh

    It will not convert RoundCube data by default, please do the following in the same directory if you want RoundCube data to be transferred:
    Code:
    wget -O cpanel_da_roundcube.php http://www.custombuild.eu/cpanel/cpanel_da_roundcube.php.txt
    wget -O php_sql_parser.tar.gz http://www.custombuild.eu/cpanel/php_sql_parser.tar.gz
    tar xzf php_sql_parser.tar.gz
    rm -f php_sql_parser.tar.gz
    How to use This Script? How to use this script?
    Please explain step by step for beginners
    thank you

  9. #29
    Join Date
    Dec 2017
    Posts
    4
    How to use this script?
    Please explain step by step for beginners
    thank you

  10. #30
    Join Date
    Jul 2005
    Location
    Paris, KY
    Posts
    29
    I am trying to run the script and I keep getting this error:

    Unable to extract username from tarball name

    Can you provide any guidance or documentation to help solve this? Thanks.

  11. #31
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,803
    Quote Originally Posted by shaggy View Post
    I am trying to run the script and I keep getting this error:

    Unable to extract username from tarball name

    Can you provide any guidance or documentation to help solve this? Thanks.
    What's the name of the backup file? It should be cpmove-username.tar.gz or username​.tar.gz.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  12. #32
    Join Date
    Aug 2006
    Location
    LT, EU
    Posts
    6,803
    Quote Originally Posted by arpahost View Post
    How to use this script?
    Please explain step by step for beginners
    thank you
    Download http://www.custombuild.eu/cpanel/cpanel_to_da.sh, apply "chmod 700 cpanel_to_da.sh", then execute the file using "./cpanel_to_da.sh" and it will provide you instructions.
    Martynas Bendorius
    MB Martynas IT. Professional server management company. Official DirectAdmin, CloudLinux, LiteSpeed and Comodo partners.

  13. #33
    Join Date
    Dec 2017
    Posts
    4
    Quote Originally Posted by smtalk View Post
    Download http://www.custombuild.eu/cpanel/cpanel_to_da.sh, apply "chmod 700 cpanel_to_da.sh", then execute the file using "./cpanel_to_da.sh" and it will provide you instructions.
    Thank you smtalk
    The result of commands :

    ./cpanel_to_da.sh
    Usage:
    ./cpanel_to_da.sh <full path to cpanel backup> [<full path to directadmin backup directory>]
    you gave #0: ./cpanel_to_da.sh

    Should we insert backup file path in sh file or somewhere?
    backupfile name : backup-12.8.2017_18-33-07_my.tar.gz

  14. #34
    Join Date
    Dec 2017
    Posts
    4
    import]# ./cpanel_to_da.sh
    Usage:
    ./cpanel_to_da.sh <full path to cpanel backup> [<full path to directadmin backup directory>]
    you gave #0: ./cpanel_to_da.sh

  15. #35
    Join Date
    Jul 2005
    Location
    Paris, KY
    Posts
    29
    Quote Originally Posted by smtalk View Post
    What's the name of the backup file? It should be cpmove-username.tar.gz or username​.tar.gz.
    I finally got it working. I unzipped the file and gzipped it again and it worked... Not sure how or why, but it did. Everything seems to have worked but a mysql DB user had to be recreated manually. Thanks for this great script. Saved a lot of time!

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •