Page 1 of 2 12 LastLast
Results 1 to 25 of 27
  1. #1

    Taking backup of a reseller account!

    Hi!
    Is there any way that reseller can take a complete backup of all sites hosted in the reseller account through WHM?

    Also is it possible to auto set FTP backup as while having root access to WHM?
    Last edited by morehost; 04-20-2004 at 11:04 PM.
    Wholesale Domain Prices for Retail Customers - Rushtoweb.com

  2. #2
    Join Date
    Aug 2002
    Posts
    645
    No, there is not a way for a reseller to perform a backup of all sites under a reseller account via WHM (though that would be a nice feature).

    And no, there is not a way (at least that I know of) to set an FTP backup via WHM.

  3. #3
    Thanks Erik,
    And isn't there any method that reseller can backup his and his clients site together.. any additional script or any workaround etc?
    Wholesale Domain Prices for Retail Customers - Rushtoweb.com

  4. #4
    Join Date
    Aug 2002
    Posts
    645
    Not a formal way anyway. You should post this in the cpanel forums as a feature request. The only negative side to this would be a gzip of that size would bog a server down for a good 5-20 minutes depending on the size of the reseller account (therefore I dont know how far it would go). You could do it the old fashioned way and log into everyones account and download a backup from the control panel. A little messy, but it gets the job done.

  5. #5
    Join Date
    Jan 2004
    Location
    New York, NY
    Posts
    1,241
    domainwala, your host can backup all of your sites - including your clients sites for you. (If they offer that option.)
    Thanks,

    Brendan Diaz
    Connect: linkedin.com/in/brendandiaz

  6. #6
    Join Date
    May 2003
    Location
    Heartland, USA
    Posts
    733
    Here's a script I "hacked" up from various snippets I found here and there... It works for me! It executes the WHM/cPanel Full Backup for each account under a Reseller Account, and the Reseller Account too, if desired. It will also FTP each site's backup to a remote server, if so configured. Hope it works for you!
    Code:
    <?php 
      /* 
      Based on original code by dv at josheli.com 
       
      What it does: 
      It will backup all accounts under a cPanel Reseller Account 
         
      How it works: 
      Reads all accounts (domain and username specifically) from the listaccts page in WHM 
      Calls the dofullbackup.html routine of cpanel for each account, using the account's username and the reseller's password 
      Creates filenames like "bkup_mydomain_com_11_11_03.tar.gz" in account's home directory 
      Saves the backup file to an ftp destination if specified 
       
      Caveats: 
      This script doesn't require cron, but can be executed from one. 
       
      Instructions: 
      1. Modify "config" variables below, to suit 
      2. From the command prompt: 
          >cd /path/to/backupScript 
          >php backup_reseller.php 
      3. ([Or] Optionally) Set up a cron job to call this script 
       
      */ 
       
      /*** BEGIN CONFIG ***/ 
    
      // Reseller Domain (e.g. myDomain.com), UserID and Password 
      $whmDomain  = 'yourDomain.com'; //your reseller domain 
      $whmUser    = 'yourResellerID'; //your web host manager user name 
      $whmPass    = 'yourResellerPwd'; //your web host manager password 
    
      // Destination; Same as offered within cPanel; Choose your poison... 
    //  $dest = 'homedir'; //Home Directory 
      $dest = 'ftp'; //Remote FTP Server 
    //  $dest = 'passiveftp'; //Remove FTP Server (Passive mode transfer) 
    
      // Email to send completion notification eMail 
      $email = 'you@yourDomain.com'; 
    
      // Remote Server (FTP/SCP only) 
      $server = 'yourFTPServer.com'; 
    
      // Remote User (FTP/SCP only) 
      $user = 'yourFTPLogonId'; 
       
      // Remote Password (FTP/SCP only) 
      $pass = 'yourFTPPwd'; 
    
      // Be kind to your kindred...  Take a nap! 
      $sleep = 60; // How many seconds to pause between each account 
       
      // BackUp the Reseller Domain too? 
      $bkupReseller = true; // Set to 'true' to backup the reseller's account, 
                            //       'false' to skip the reseller's account 
       
       
      /*** END CONFIG ***/ 
       
      set_time_limit(0); 
      echo ">> Reseller Full Backup <<\n"; 
       
      // Base64 Encode Reseller UserID & Password 
      $authstr = "$whmUser:$whmPass"; 
      $whmUidPass = base64_encode($authstr); 
               
       
      // Get the WHM 'list accounts' page 
      $socket = fsockopen($whmDomain,2086,$errno,$errstr); 
      if (!$socket) { 
         echo "fSocket Error to WHM: $errstr ($errno)<br />\n"; 
         die(); 
      } else { 
        fputs($socket,"GET /scripts2/listaccts?viewall=1\r\n"); 
        fputs($socket,"HTTPS/1.0\r\n"); 
        fputs($socket,"Host: $whmDomain\r\n"); 
        fputs($socket,"Authorization: Basic $whmUidPass \r\n"); 
        fputs($socket,"Connection: close\r\n\r\n"); 
         
        $page = ''; 
        while (!feof($socket)) { 
          $page .= fgets($socket,4096); 
        } 
        fclose($socket); 
      } 
       
      // Get each account's table row 
      $int2 = preg_match_all("/<tr class=(?:tdshade2|tdshade1)>(.*?)<\/tr>/is", $page, $matches); 
    
      if($int2 > 0 && is_array($matches[1])) { 
          foreach($matches[1] as $match) {         
              $account = explode('</td><td>',$match); 
              $account[0] = strip_tags(trim($account[0])); //domain 
              $account[2] = strip_tags(trim($account[2])); //username 
               
              // Base64 Encode Account UserID w/ Reseller Password 
              $authstr = "$account[2]:$whmPass"; 
              $cPanelUidPass = base64_encode($authstr); 
               
              // Kick off the cPanel Backup for the Account... 
              $socket = fsockopen($account[0],2082,$errno,$errstr); 
              if (!$socket) { 
                 echo "fSocket Error: $errstr ($errno)\n"; 
              } else { 
                echo "Processing client account: $account[0] \n"; 
                fputs($socket,"GET /frontend/x/backup/dofullbackup.html?dest=$dest&email=$email&server=$server&user=$user&pass=$pass\r\n"); 
                fputs($socket,"HTTPS/1.0\r\n"); 
                fputs($socket,"Host: $account[0] \r\n"); 
                fputs($socket,"Authorization: Basic $cPanelUidPass \r\n"); 
                fputs($socket,"Connection: close\r\n\r\n"); 
                 
                while (!feof($socket)) { 
                  fgets($socket,4096); 
                } 
                fclose($socket); 
              } 
              sleep($sleep); 
            } 
      } 
       
      // Now do yourself if desired... 
      if($bkupReseller){ 
        // Kick off the cPanel Backup for the Reseller Account... 
        $socket = fsockopen($whmDomain,2082,$errno,$errstr); 
        if (!$socket) { 
           echo "fSocket Error: $errstr ($errno)\n"; 
        } else { 
          echo "Processing reseller account: $whmDomain \n"; 
          fputs($socket,"GET /frontend/x/backup/dofullbackup.html?dest=$dest&email=$email&server=$server&user=$user&pass=$pass\r\n"); 
          fputs($socket,"HTTPS/1.0\r\n"); 
          fputs($socket,"Host: $whmDomain \r\n"); 
          fputs($socket,"Authorization: Basic $whmUidPass \r\n"); 
          fputs($socket,"Connection: close\r\n\r\n"); 
           
          while (!feof($socket)) { 
            fgets($socket,4096); 
          } 
          fclose($socket); 
        } 
      } 
      echo ">> Le Fini <<\n\n"; 
    ?>
    You've got to accentuate the positive; Eliminate the negative
    Latch on to the affirmative; Don't mess with Mister In-Between

    -Bob

  7. #7
    Join Date
    Mar 2003
    Posts
    389
    will try that later - if it works, superb!!!!!
    thanks a lot.

    ryan

  8. #8
    That's a very nice script you have there, I like the listaccts part and may resue it in a similar project if you agree (with credit)

    There are two problems with this line:
    Code:
    <?php 
                fputs($socket,"GET /frontend/x/backup/dofullbackup.html?dest=$dest&email=$email&server=$server&user=$user&pass=$pass\r\n");
    1- All your clients MUST use the "X" theme ( /frontend/x ) or at least the must all use the SAME theme. If they don't, you're screwed this line will not work (cpanel seems to make all themes files unavailable if they are not the user's theme)

    2- The FTP feature is cPanel's FTP feature, and it doesn't work in PASSIVE mode, making it impossible to upload to a FTP server behing a router (like your home PC on a cable modem with a router).

    I had a lot of trouble trying to get around problem #2 and still got no results.

    I am currently planning to write a backup procedure from scratch, something that would use system function like gzip etc to backup, and NOT rely on cPanel's backup.

    I already promised Ryan I'd write this script, but still did not find time to fiddle around with this stuff. And now that I'm on HIS server, i want to be extra careful whith what I'm doing

    Alex

  9. #9
    Thanks for the great script, I am testing it...
    Wholesale Domain Prices for Retail Customers - Rushtoweb.com

  10. #10
    Join Date
    Sep 2001
    Location
    New York
    Posts
    19
    This script is A.W.E.S.O.M.E. It works perfectly for me. Two thumbs up!

    However, there's a bug in cpanel itself - at full backups, cpanel actually does NOT backup mySql databases. Anyone knows how to get around this (other than logging into each domain and backup manually)?

    Or would that be possible for a seperate script to backup ONLY mySql? Thanks!

  11. #11
    Join Date
    Mar 2003
    Posts
    389
    Originally posted by alex-info
    I am currently planning to write a backup procedure from scratch, something that would use system function like gzip etc to backup, and NOT rely on cPanel's backup.

    I already promised Ryan I'd write this script, but still did not find time to fiddle around with this stuff. And now that I'm on HIS server, i want to be extra careful whith what I'm doing

    Alex
    Alex has now finished his script - and it works a treat.
    Just thought I would say incase anyone is still after a script

    Ry

  12. #12
    I would be interested in Alex's new script, especially if it solves the MySql problem that CPanel has with full backup. How can I get a copy?

  13. #13
    Robnelli, my script is not 100% complete but the actual version could be considered as a beta and is 100% working. With it you can backup directories and mysql databases, you have to specify (in a config file) what you want to backup.

    If you would be interested in trying this script I would really welcome you as a beta tester, the scripts works great for me and rchosts (Ryan) too .. so I'm pretty sure it would work for you too

    Contact me at the email adress: alex [@] alex-info.net

    I'll email you the script (very simple to install and configure). If things work out for you, I'll give you a free copy as a thank you for you beta-testing.

    You need the IonCube loader installed on your server since the script is protected using IonCube, but most hosts already have the IonCube loader installed, so that shouldn't be a problem.

    For the others, FYI the script is a simple backup script, you specify a list pf directories and databases to backup, the script does the backups (via a web interface or a CRON job) and can store them on the server or FTP them to a remote PC.

    I coded the script because none of the scripts I found were able to upload to my home PC behind a firewall (problems with passive mode) but this one works great it uploads my backups right here every night.

    To restore a mysql backup you can use PhpMyAdmin and upload the backup file. To restore a directory backup you need SSH access to untar and ungzip the file. A restore option may come in a later release.

  14. #14
    Rob & Overhosted, I sent you the email with download and install instructions. Thanks for your interest in my script !

  15. #15
    Join Date
    Nov 2003
    Location
    Kissimmee, FL
    Posts
    57
    I'm not so sure that it would be a good thing if the resellers could setup automatic backup of their accounts. I'm sure such a feature would drive the server load way up when several backups are being performed, and that would be a definite problem for the server admins.
    -Andre, MidFloridaWebServices, LLC
    >> Shared & Reseller hosting
    >> friendly & honest service

  16. #16
    Join Date
    Nov 2003
    Location
    Kissimmee, FL
    Posts
    57

    Re: Taking backup of a reseller account!

    Originally posted by domainwala


    Also is it possible to auto set FTP backup as while having root access to WHM?
    I forgot to add: yes, if you have root access, you can setup FTP backup with WHM. (daily, weekly, monthly...)
    -Andre, MidFloridaWebServices, LLC
    >> Shared & Reseller hosting
    >> friendly & honest service

  17. #17

    Re: Re: Taking backup of a reseller account!

    Originally posted by gimme5
    I forgot to add: yes, if you have root access, you can setup FTP backup with WHM. (daily, weekly, monthly...)
    Actually I wanted to know if you can setup backup if you not have root pass in the manner you do when you have root pass...
    Wholesale Domain Prices for Retail Customers - Rushtoweb.com

  18. #18
    Join Date
    Nov 2003
    Location
    Kissimmee, FL
    Posts
    57
    oh, ok, sorry, I misunderstood
    -Andre, MidFloridaWebServices, LLC
    >> Shared & Reseller hosting
    >> friendly & honest service

  19. #19
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    769
    Alex, this would be a great script if it works. I'm looking for something like that myself as well!

    My question is - how will the restore work? Does it keep all WHM information intact as well so when I restore, it will restore all my WHM settings including account information?

  20. #20
    And dns files too?? Could that be backed up and restored?
    Wholesale Domain Prices for Retail Customers - Rushtoweb.com

  21. #21
    why would rrdega's script stop working all of a sudden?..

  22. #22
    help on this please

  23. #23
    Join Date
    Sep 2005
    Location
    Southern California
    Posts
    114
    I don't have much experience with cpanel, but I know in other control panels they have features where you can create backups on the admin/reseller and user level. A good example of this type of control panel would be DA. Good luck with the script if it works for you.

  24. #24
    thanks for the reply, yeah the script was working and now only does my main reseller account?..

    I know i can access the other accounts with admin password but so much hassle. are there any other scripts out there to do this task? even if i have to buy it.

    cheers

  25. #25
    Join Date
    Dec 2004
    Location
    New York, NY
    Posts
    10,710
    Perhaps the latest cPanel version (that some hosts may have upgraded to) has some changes in the structure?

    - Gsv
    MediaLayer, LLC - www.medialayer.com Learn how we can make your website load faster, translating to better conversion rates for your business!
    The pioneers of optimized web hosting, featuring LiteSpeed Web Server & SSD Storage - Celebrating 10 Years in Business

Page 1 of 2 12 LastLast

Posting Permissions

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