The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is this backup system makes sense ?

Discussion in 'General Discussion' started by kkoray, Jan 28, 2008.

  1. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Hi, I have this server and database keeps fails. I'm sick of this failings. I just bring back the website from 4 days ago backup. Some reason Vbulletin database fails. Whatever I need a backup system that will take the account backup in the giving time. Cpanel has a backup system but it doesn't have a timing. What the hell ? it is taking a backup but you don't know when . I need something that can take a backup in giving time because it is pretty busy website you have to backup at 6am in the morning or any ideas will help.

    Let see ok, put yourself in this situation. You have website forum 2gb database + 1.4gb files attachments etc. vbulletin 3.6.8PL2 last version. You have cpanel. What would you do for database you know it will fail 15 days or so..

    Centos 4.6
     
  2. xrserver

    xrserver Well-Known Member

    Joined:
    Jan 18, 2008
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    If you make a backup from cpanel I thought it did put a timestamp on it but all you have to do is right click on the backup and click properties and look at the "created" date.
     
  3. rpmws

    rpmws Well-Known Member

    Joined:
    Aug 14, 2001
    Messages:
    1,824
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    back woods of NC, USA
    run a cron job to backup your DB when you want it to :D or figure out why VB is messing up your databases?
     
  4. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    nope it is old database 4 years. I don't know why it messes up all the time. Can you please explain cron backups. How do you do this ? what are the commands? can you give me example ?
     
  5. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    xrserver timestamp is not important. I would like cpanel to take a backup when I want. cpanel takes the backup when ever it wants :) you can only setup a daily weekly but not a time frame. I want to run the backup on 6am in the morning there is no optiom for that...


     
  6. xrserver

    xrserver Well-Known Member

    Joined:
    Jan 18, 2008
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    ok i got ya. this is the script you are looking for then. just past it into notepad or any text editor and name it backup.php Then go into cpanel and make a cron job such as this one

    Code:
    00 20 * * * /usr/local/bin/php /home/youraccount/backup.php
    That makes it at 8pm everynight you can change it to whatever you want. Just replace youraccount with your account name and make sure to place the backup.php wherever you specify in the cron job.

    Here is the script.

    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 = "username"; // Username used to login to CPanel
    $cppass = "password"; // Password used to login to CPanel
    $domain = "example.com"; // Domain name where CPanel is run
    $skin = "x"; // 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 = "ftpusername"; // Username for FTP account
    $ftppass = "ftppassword"; // Password for FTP account
    $ftphost = "ftp.example.com"; // Full hostname or IP address for FTP host
    $ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)
    
    // Notification information
    $notifyemail = "you@example.com"; // Email address to send results
    
    // Secure or non-secure mode
    $secure = 0; // 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 = 0;
    
    // *********** 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&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);
    
    ?>
    
     
  7. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    wow this what it calls and perfect answer thank you... I will play with this..
     
  8. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    By default, cpbackup will run at 1am but you can actually change it in /var/spool/cron/root (don't forget to restart crond after editing the file).
    You can also install the cpanel plugin "cronconfig" that allows you to configure cpbackup and upcp time from your WHM :)
     
  9. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    thank you yapluka this is good answer I will go for this probabbly. let see if I can find this addon cronconfig
     
  10. kkoray

    kkoray Member

    Joined:
    Nov 16, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    thats it. Wow. I wasn't even know there is addon like this darn. Thank you so much this is great backing up everyday :)
    If you read this thread guys install this program and backup everyday. you never know what is going to happen...



    Main Menu
    Command Minute Hour Day Month Weekday
    upcp
    cpbackup
    Command: upcp upcp is the program that updates cPanel. We recommend running this script once a day, it has, by default, been set to a random time between 9pm and 6am local time. You may set this to whatever time you wish, however we recommend setting it to run during off peak hours.
    Command: cpbackupcpbackup is the program used to run backups on your server. It is defaultly set to run at 1am as this is an off peak time for most servers. We recommend setting this to an off peak time early enough to allow your server to finish backups before entering peak time again. If you have backups disabled then the program will immediatly exit after run
    Cron InformationCron jobs are jobs that are set to run at a certain time based on the minute, hour, day, month, and weekday given to them. The Hour is always set in military time and based on the time that your server is set to. Day of the month you want something ran on (15 would be the 15th day of the month). Month is the month you want the cronjob to run in 1=January and 12=December. Weekday is the day of the week you want it to run on 0=Sunday and 6=Saturday. * means to run it at every instance of this section, so a * in day would mean to run the job everyday, while a * in Minute would run the job every minute.
    Example: Minute = 15; Hour = 21; Day = *; Month = *; Weekday = *. This process would run everyday at 2115, or in 12hr format 9:15pm
     
Loading...

Share This Page