Results 1 to 9 of 9
  1. #1

    schedula backups with cpanel

    Hi,

    I am using shared linux hosting with cpanel and I am new to this topic, so please help if you can.

    I use the backup app in cpanel to do full backups of the public_html folder and databases. the backups are saved in the home directory. I could not figure out how to change the destination for the backups. now I just realized that all my backups disappeared. also the used storage indicator shows that I am using less storage than before, but there was still tons of space available so I am not sure why would someone do that.

    There see cron jobs in the cpanel, however I could not figure out how to use it.

    I would like to setup automatic backup:
    -twice a day at 3AM and 3 PM
    -full backup of www_folder and databases
    -save the backup in the home_folder/backup

    can anyone please help

    really appreciate anyone's help

  2. #2
    while you are backing up it ask you the directory, don't you choose the home for this?

  3. #3
    Join Date
    Nov 2008
    Location
    Florida, U.S
    Posts
    1,686
    If your backups are disappearing, it might be your host's policy not to allow shared accounts to be used for backup purposes (aside from 1 or 2 backups of the account). Have you asked your host about the missing backups?

    Also, there many easy scripts out there to use to create a automatic backup of the cPanel account using cron job. I would recommend you setup one and then have the backups uploaded via FTP to a backup server like www.BQbackup.com so you can have 10GB worth of backups if you wish.

    Here is the code for the one I use for personal sites (FULL cPanel Backup):
    Code:
    <?php
    
    // PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
    // This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)
    
    // ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********
    
    // Info required for cPanel access
    $cpuser = "XXXX"; // Username used to login to CPanel
    $cppass = "XXXX"; // Password used to login to CPanel
    $domain = "XXXX"; // Domain name where CPanel is run
    $skin = "x3"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme
    
    // Info required for FTP host
    $ftpuser = "XXXX"; // Username for FTP account
    $ftppass = "XXXX"; // Password for FTP account
    $ftphost = "XXXX"; // Full hostname or IP address for FTP host
    $ftpmode = "XXXX"; // FTP mode ("ftp" for active, "passiveftp" for passive)
    $ftpport = "21"; // Port (default = 21)
    $rdir = "/"; // Remote dir (defaut = / )
    
    // Notification information
    $notifyemail = "[email protected]"; // Email address to send results
    
    // Secure or non-secure mode
    $secure = 1; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP
    
    // Set to 1 to have web page result appear in your cron log
    $debug = 1;
    
    // *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********
    
    if ($secure) {
    $url = "ssl://".$domain;
    $port = 2083;
    } else {
    $url = $domain;
    $port = 2082;
    }
    
    $socket = fsockopen($url,$port);
    if (!$socket) { echo "Failed to open socket connection… Bailing out!\n"; exit; }
    
    // Encode authentication string
    $authstr = $cpuser.":".$cppass;
    $pass = base64_encode($authstr);
    
    $params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&port=$ftpport&rdir=$rdir&submit=Generate Backup";
    
    // Make POST to cPanel
    fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
    fputs($socket,"Host: $domain\r\n");
    fputs($socket,"Authorization: Basic $pass\r\n");
    fputs($socket,"Connection: Close\r\n");
    fputs($socket,"\r\n");
    
    // Grab response even if we don't do anything with it.
    while (!feof($socket)) {
    $response = fgets($socket,4096);
    if ($debug) echo $response;
    }
    
    fclose($socket);
    
    ?>
    Save this file as backup.php or what ever name you like and place it in your home directory (not in public_html) after you edit the required info and then set the proper permissions (644 should work but if not use 755).

    After that you can setup the cron job to execute the backup.php file every day or what ever you like. Just try not to run too many backups in one day as this can slow down the server.

    The code should look something like this (weekly backup):

    Code:
    0 4 * * 3 php -q /home/username/backup.php

    Hope that helps!
    HOSTLEET.COM, LLC - Elite Website Hosting Since 2008!
    Fast Reliable Affordable Secure Friendly & Courteous
    RISK-FREE Money Back Guarantee PCI-Compliant Checkout
    U.S.A Based & Operated Read Through Our Most F.A.Q's!

  4. #4
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    10,482
    Do you mind if I ask how big your backups are, could be, would be?
    l Dedigeeks (Twitter) • Shared • Reseller • Cloud VPS • Since 2010
    l Leading AU Hosting Provider • Multiple locations - around the globe!
    l cPanel/WHM • R1Soft Backups • 24/7/365 Support • 99.9% Uptime Guarantee
    l www.yourcompanynamehere.com • Customer Service Rep. • Superior Service Guarantee

  5. #5
    Quote Originally Posted by Sparrow-Sean View Post
    Do you mind if I ask how big your backups are, could be, would be?

    around 200 MB right now,

    I assume in the future I could have 1000 more product pictures so another 200 MB.

    thanks

  6. #6
    Quote Originally Posted by HostLeet View Post
    If your backups are disappearing, it might be your host's policy not to allow shared accounts to be used for backup purposes (aside from 1 or 2 backups of the account). Have you asked your host about the missing backups?

    Also, there many easy scripts out there to use to create a automatic backup of the cPanel account using cron job. I would recommend you setup one and then have the backups uploaded via FTP to a backup server like www.BQbackup.com so you can have 10GB worth of backups if you wish.

    Here is the code for the one I use for personal sites (FULL cPanel Backup):
    Code:
    <?php
    
    // PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server.
    // This script contains passwords. KEEP ACCESS TO THIS FILE SECURE! (place it in your home dir, not /www/)
    
    // ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED *********
    
    // Info required for cPanel access
    $cpuser = "XXXX"; // Username used to login to CPanel
    $cppass = "XXXX"; // Password used to login to CPanel
    $domain = "XXXX"; // Domain name where CPanel is run
    $skin = "x3"; // Set to cPanel skin you use (script won't work if it doesn't match). Most people run the default x theme
    
    // Info required for FTP host
    $ftpuser = "XXXX"; // Username for FTP account
    $ftppass = "XXXX"; // Password for FTP account
    $ftphost = "XXXX"; // Full hostname or IP address for FTP host
    $ftpmode = "XXXX"; // FTP mode ("ftp" for active, "passiveftp" for passive)
    $ftpport = "21"; // Port (default = 21)
    $rdir = "/"; // Remote dir (defaut = / )
    
    // Notification information
    $notifyemail = "[email protected]"; // Email address to send results
    
    // Secure or non-secure mode
    $secure = 1; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP
    
    // Set to 1 to have web page result appear in your cron log
    $debug = 1;
    
    // *********** NO CONFIGURATION ITEMS BELOW THIS LINE *********
    
    if ($secure) {
    $url = "ssl://".$domain;
    $port = 2083;
    } else {
    $url = $domain;
    $port = 2082;
    }
    
    $socket = fsockopen($url,$port);
    if (!$socket) { echo "Failed to open socket connection… Bailing out!\n"; exit; }
    
    // Encode authentication string
    $authstr = $cpuser.":".$cppass;
    $pass = base64_encode($authstr);
    
    $params = "dest=$ftpmode&email=$notifyemail&server=$ftphost&user=$ftpuser&pass=$ftppass&port=$ftpport&rdir=$rdir&submit=Generate Backup";
    
    // Make POST to cPanel
    fputs($socket,"POST /frontend/".$skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
    fputs($socket,"Host: $domain\r\n");
    fputs($socket,"Authorization: Basic $pass\r\n");
    fputs($socket,"Connection: Close\r\n");
    fputs($socket,"\r\n");
    
    // Grab response even if we don't do anything with it.
    while (!feof($socket)) {
    $response = fgets($socket,4096);
    if ($debug) echo $response;
    }
    
    fclose($socket);
    
    ?>
    Save this file as backup.php or what ever name you like and place it in your home directory (not in public_html) after you edit the required info and then set the proper permissions (644 should work but if not use 755).

    After that you can setup the cron job to execute the backup.php file every day or what ever you like. Just try not to run too many backups in one day as this can slow down the server.

    The code should look something like this (weekly backup):

    Code:
    0 4 * * 3 php -q /home/username/backup.php

    Hope that helps!

    Thanks Hostleet, this looks like what I am looking for.

    -you were right I checked the TOS, and the host does delete it
    -Is this script running at the remote site?
    -excuse my ignorance, but why is it asking for cpanel user info
    -I plan on downloading the backups with an ftp client, but for speed I would like them store in the home/backup folder meanwhile.

  7. #7
    Join Date
    May 2008
    Location
    Melbourne, Australia
    Posts
    10,482
    around 200 MB right now,

    I assume in the future I could have 1000 more product pictures so another 200 MB.

    thanks
    The only reason I am curious is because ordinary cPanel backups can cause server issues with performance if they are large and you are backing them up daily, they can cause issues depending the the hardware and resources of the system.

    200MB is not overally large so I think you should be fine for the short time as long as the backup does not suddenly grow to 1GB+.
    l Dedigeeks (Twitter) • Shared • Reseller • Cloud VPS • Since 2010
    l Leading AU Hosting Provider • Multiple locations - around the globe!
    l cPanel/WHM • R1Soft Backups • 24/7/365 Support • 99.9% Uptime Guarantee
    l www.yourcompanynamehere.com • Customer Service Rep. • Superior Service Guarantee

  8. #8
    Join Date
    Nov 2008
    Location
    Florida, U.S
    Posts
    1,686
    Quote Originally Posted by aireal View Post
    Thanks Hostleet, this looks like what I am looking for.

    -you were right I checked the TOS, and the host does delete it
    -Is this script running at the remote site?
    -excuse my ignorance, but why is it asking for cpanel user info
    -I plan on downloading the backups with an ftp client, but for speed I would like them store in the home/backup folder meanwhile.
    Sure thing, glad I could help.

    The script needs the cPanel user info of the account it's backing up. That's why you place the file (e.g. - backup.php) in your cpanel account inside your home directory (not your public_html folder), this way only you and the system have access to it and nobody else.

    Once you set the cron job, it will execute the file and run the backup script. The script will then make a full cPanel backup of the account and will automatically upload it via FTP to the server you set in the FTP details section of the script. If you want the backup to go to your own account you simply leave the FTP details blank. However, I do recommend you send the backups to another server instead just in case anything happens to your hosting account (downtime ect..).
    HOSTLEET.COM, LLC - Elite Website Hosting Since 2008!
    Fast Reliable Affordable Secure Friendly & Courteous
    RISK-FREE Money Back Guarantee PCI-Compliant Checkout
    U.S.A Based & Operated Read Through Our Most F.A.Q's!

  9. #9
    Quote Originally Posted by Sparrow-Sean View Post
    The only reason I am curious is because ordinary cPanel backups can cause server issues with performance if they are large and you are backing them up daily, they can cause issues depending the the hardware and resources of the system.

    200MB is not overally large so I think you should be fine for the short time as long as the backup does not suddenly grow to 1GB+.
    sofar, I did not see any issues with CPU utilization, it hardly shows anything. but good point, I guess when I am done with uploading pictures, I will just backup the database (joomla) and I will not need to do backups of the www- folders.

Similar Threads

  1. Replies: 0
    Last Post: 05-26-2010, 04:34 PM
  2. cPanel Backups
    By Bullsoft - Thomas in forum Hosting Software and Control Panels
    Replies: 4
    Last Post: 05-11-2009, 03:13 AM
  3. cPanel Backups
    By Jackula in forum Dedicated Server
    Replies: 7
    Last Post: 07-19-2003, 06:25 AM
  4. cPanel backups
    By kickmybutt in forum Hosting Security and Technology
    Replies: 1
    Last Post: 05-14-2003, 01:04 PM
  5. cpanel backups
    By badr in forum Reseller Hosting
    Replies: 1
    Last Post: 05-10-2003, 06:12 AM

Posting Permissions

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