Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 17
  1. #1
    Member
    Join Date
    Nov 2009
    Posts
    13

    Default Backups/Restore and Migration Calls

    Hello!

    This is development question can i do the followings.

    1. Can i generate all accounts backups of my customer using his reseller login of old host? in this case i have the root login of myserver so no issue for me to run any ssh command at my server but point is this does is it possible for me to do that without mentioned all accounts list or password etc or SSH access of his old host?... Its kind of same feature that you allow for one account migration in WHM for root called (Copy an account from another server with account password).

    2. How i can restore multiple accounts using SSH command or xml-api calls i want to allow my customers to restore multiple accounts by themselves so which means reseller will do themselves.

    3. How i can make an efficenet plugin which check server load first before taking or restoring backup how to check server load ? so i get a numeric value and on the bases of i allow or apply specific command?

    4. What Api call to restore single account?


    Looking for great help same as before.
    Thanks
    Rao

  2. #2
    Member
    Join Date
    May 2008
    Posts
    30

    Default

    Unfortunately, it looks like most of the backup functionality has not been exposed to the API at this time.

    However, you can restore a backup at the command line by placing it in /home and doing:

    /scripts/restorepkg <username>

    So you can automate that.

    Also, the cpanel backup system does already check the load specified in WHM | Tweak Settings | The load average above the number of CPUs at which log file processing should be suspended.

    If you have that set to 0, it will wait until the load is .99 or lower to run (or continue running).

    Hope that helps...

  3. #3
    Member
    Join Date
    Nov 2009
    Posts
    13

    Default

    ok great thanks for clearing i have some other questions

    1. Is it possible to fetch account from anyother server without having root login or that server? i mean if i have only my cpanel account details how i can fetch that account using php code or ssh command to a new server where i have the SSH as well as root access?

    2. How i can generate backups using php or SSH commands and send them to an ftp server auto like how cpanel backup feature work

    Thanks

  4. #4
    Member
    Join Date
    May 2008
    Posts
    30

    Default

    I'm afraid I'm not aware of a built in way to do those two things. You'd need to scrape or use Expect to automate those processes.

  5. #5
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    Quote Originally Posted by cpanel_lee View Post
    I'm afraid I'm not aware of a built in way to do those two things. You'd need to scrape or use Expect to automate those processes.
    Actually you can do it from the interface if you have the reseller login but it's not pretty ....

    You can use the reseller account to login to the cpanel control panels of each of the resold accounts without password and setup "on demand" full backups with remote FTP as the storage destination.

    Without either root or reseller access then yes ---

    would need to login using the password to each and every cpanel account

  6. #6
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    (Last post above assuming server owner didn't disable reseller to user logins)

  7. #7
    Member
    Join Date
    Nov 2009
    Posts
    13

    Default

    well thanks everyone though i was looking something from cpanel team as they know as they coded it, anyway finaly i have done what i was looking with combination of PHP and SSH commands. so Thanks for all.

  8. #8
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Alright, so let's start from the beginning:

    1) it is possible to generate a backup with just a user's login. You call the API1 function Fileman::fullbackup via the XML-API

    ApiFileman < ApiDocs/Api1 < TWiki

    Once this has been done, call Backups::listfullbackups to monitor for the creation of the new file

    ApiBackups < ApiDocs/Api2 < TWiki

    This can be downloaded via the instructions in the API docs (you should be able to do this with reseller login, however your milage may vary).

    2.) inside of 11.25.1 we have added a new call called "backuprestore" that will allow you to restore backups, this can be used to automate the restoration process. That being said, /scripts/restorepkg is probably preferable.

    3.) You can generate backups via the CLI using SSH via /scripts/pkgacct $accountname. This will only work as root
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  9. #9
    Member
    Join Date
    Nov 2009
    Posts
    13

    Default

    Quote Originally Posted by cPanelMatt View Post
    Alright, so let's start from the beginning:

    1) it is possible to generate a backup with just a user's login. You call the API1 function Fileman::fullbackup via the XML-API

    ApiFileman < ApiDocs/Api1 < TWiki

    Once this has been done, call Backups::listfullbackups to monitor for the creation of the new file

    ApiBackups < ApiDocs/Api2 < TWiki

    This can be downloaded via the instructions in the API docs (you should be able to do this with reseller login, however your milage may vary).

    2.) inside of 11.25.1 we have added a new call called "backuprestore" that will allow you to restore backups, this can be used to automate the restoration process. That being said, /scripts/restorepkg is probably preferable.

    3.) You can generate backups via the CLI using SSH via /scripts/pkgacct $accountname. This will only work as root
    Hello!

    Thanks this is what i was looking but could you clear followings

    1. Fileman::fullbackup( dest, server, user, pass, email, port, rdir )
    how should i run the above code in php? i mean if i have a root or reseller login details than how i will call that function and how the system will know i am asking backup for which account?

    Like how i tell system for which account i am trying to generate backup using that function command line?

  10. #10
    Member
    Join Date
    Nov 2009
    Posts
    13

    Default

    HellO!

    below is code which i was looking

    <?php
    $target_host = 'DomainToBackup.com';
    $cpanel_userid = 'yourCpanelUsername';
    $cpanel_pass = 'yourCpanelPassword';
    $cpanel_theme = 'yourCpanelTheme';
    $ftp_host = 'ftp.storageDomain.com';
    $ftp_user = 'ftp_host_Username';
    $ftp_pass = 'ftp_host_Password';
    $email = 'your@email.com';

    //
    // DO NOT ALTER ANYTHING BELOW THIS LINE
    //
    $user_pass = "$cpanel_userid:$cpanel_pass";
    $authentication = base64_encode($user_pass);
    $socket = fsockopen($target_host,2082);
    if (!$socket) {
    echo "$errstr ($errno)<br />\n";
    } else {
    fputs($socket,"POST /frontend/$cpanel_theme/backup/dofullbackup.html?dest=ftp&email=$email&server=$ftp_host&user=$ftp_user&pass=$ftp_pass&submit=Generate Backup\r\n");
    fputs($socket,"HTTP/1.0\r\n");
    fputs($socket,"Host: $target_host\r\n");
    fputs($socket,"Authorization: Basic $authentication \r\n");
    fputs($socket,"Connection: close\r\n\r\n");

    while (!feof($socket)) {
    $request = fgets($socket, 4096);
    }
    echo 'Done.';
    fclose($socket);
    }
    ?>

  11. #11
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,893
    cPanel/Enkompass Access Level

    Root Administrator

    Lightbulb Important cPanel/WHM Version Number Designation Change

    Please Note: Important cPanel/WHM Version Number Designation Change

    As of July 28, 2010 the cPanel/WHM version number designations have been officially changed.

    Version 11.25.1 is now designated 11.28 and version 11.25.2 is now designated 11.30.

    These new changes were explained in some detail recently at the July 2010 - Quarterly Road map - Webinar direct from cPanel's PodCast Studio in Houston, Texas with speakers David Grega and Mario Rodriguez.

    An official press release about these changes is forthcoming and can be accessed at this link as soon as it's made available to the Forum Team:
    Important cPanel/WHM Version Number Designation Change (To be updated)

    This post serves to update users who are subscribed to threads (where this message is posted) looking forward to upcoming enhancements in future versions of cPanel.

  12. #12
    Member
    Join Date
    Sep 2003
    Posts
    124

    Default Re: Backups/Restore and Migration Calls

    Maybe Im blind, but im not seeing this backup restore feature that you mentioned called 'backuprestore'. Its no where in your docs for any version of the api. Am I missing something?

  13. #13
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: Backups/Restore and Migration Calls

    Hi MACscr,

    I think this is what Matt is referring to: RestoreAccount < SoftwareDevelopmentKit < TWiki. The XML/JSON-API function is 'restoreaccount' and is officially available in 11.28+ (though is probably present in some other incarnation of the development builds since 11.25 [like 11.25.1, which Matt references, and 11.27]).

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  14. #14
    Member
    Join Date
    Sep 2003
    Posts
    124

    Default Re: Backups/Restore and Migration Calls

    Quote Originally Posted by cPanelDavidN View Post
    Hi MACscr,

    I think this is what Matt is referring to: RestoreAccount < SoftwareDevelopmentKit < TWiki. The XML/JSON-API function is 'restoreaccount' and is officially available in 11.28+ (though is probably present in some other incarnation of the development builds since 11.25 [like 11.25.1, which Matt references, and 11.27]).

    Regards,
    -DavidN
    Ah, wrong keyword. Thanks!

  15. #15
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default Re: Backups/Restore and Migration Calls

    No problem. Glad I could help!

    Best Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

Similar Threads & Tags
Similar threads

  1. Problem with backups/migration after cpanel update
    By cesarlwh in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-09-2011, 01:18 AM
  2. Question About Restore restore multiple backups via ssh?
    By assassin85 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-13-2009, 08:33 AM
  3. restore backup: backups not found in /restore/cpbackup
    By Morgana in forum Data Protection
    Replies: 1
    Last Post: 08-12-2008, 08:49 AM
  4. 'Restore Backups' / 'Restore Multiple Backups' - No users listed!
    By mitu in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 01-31-2007, 04:08 AM
  5. if you need to restore backups...
    By Lem0nHead in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-10-2004, 07:10 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube