Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 39
  1. #1
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default Backup to Remote Server

    I looked around these forums and I saw that alot of people were looking for a way to backup to a remote server automagically (as cPanel speaks). I got this off of the DedicatedNow forums and it's working great for everyone there. The instructions are totally in ssh, so if you don't like getting your hands dirty, this isn't the method for you. OK, here I go.

    Part 1: Changing backup settings
    Login to WHM and change them to the following:
    Daily backups,
    Mount disabled,
    Bailout disabled,
    Incremental disabled,
    Config files enabled,
    SQL per account and entire,
    Access logs disabled

    Part 2: Installing ftpbackup
    SSH or Telnet into the server as root
    wget http://netsw.org/net/ip/filetrans/ft...kup-2.1.tar.gz
    tar zxvf ftpbackup-2.1.tar.gz
    cd ftpbackup-2.1
    make
    make install
    close the window

    Part 3: Setting up the script
    SSH or Telnet into the server as root
    pico -w backup.pl
    copy and paste the script below into the window:
    Code:
    #!/usr/bin/perl 
    
    #FTP Server Information here 
    $ftps = "ftp server name here"; 
    $ftpu = "username here"; 
    $ftpp = "password here"; 
    $serv = "server name here"; 
    
    system("/bin/tar cfp - /backup/cpbackup/weekly | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv.tar.gz");
    edit the "FTP Server Information here" variables to match your own (server name is the hostname or IP address of the ftp address where the files will be stored, username and password are for the ftp server, and server name is simply away of naming the files, ex: server1)
    exit Pico by holding Control-X
    answer Yes to save changes
    chmod 755 backup.pl
    If you want the script to run daily:
    mv backup.pl /etc/cron.daily/backup.pl
    If you want the script to run weekly:
    mv backup.pl /etc/cron.weekly/backup.pl
    If you want the script to run monthly:
    mv backup.pl /etc/cron.monthly/backup.pl
    Close the window

    You should be all set right now. You can test the script out by doing:

    cd /
    ./etc/cron.daily/backup.pl

    You'll get the following error message:
    /bin/tar: Removing leading `/' from member names

    but it's ok - it's normal. It happens everytime. The script puts all the individual files into one single tarball which makes backing up to your computer so much easier. Also, it barely uses any system resources since all the files are already tarballed, it can't compress them any further, just combine them. The upload time depends on network traffic, packet loss, etc etc. If both your server and the backup ftp server are within the same datacenter, you should be able to get 10gb transferred in less than 30 minutes - however, I don't have nearly that much space used yet, I'm just speaking from what other people have told me. My backup file is only 400mb

    If you want to host an ftp server on your own computer to backup onto, I recommend CesarFTP, it's freeware and pretty easy to setup Hope this post was helpful to at least one person!

    cPanel.net Support Ticket Number:

  2. #2
    Member bmcpanel's Avatar
    Join Date
    Jun 2002
    Posts
    546

    Default

    Thanks, dude.

    cPanel.net Support Ticket Number:

  3. #3
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    No prob

    cPanel.net Support Ticket Number:

  4. #4
    Member
    Join Date
    Jan 2003
    Posts
    9

    Default

    does this back whole server?

    how can you restore/(thur whm restore?)


    thanks

    cPanel.net Support Ticket Number:

  5. #5
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    This backs up everything that WHM backs up normally (the /home directory, emails, apache files, mysql db's, etc). If you want it to backup the *entire* server, here's what you would change the script to:

    Code:
    #!/usr/bin/perl 
    
    #FTP Server Information here 
    $ftps = "ftp server name here"; 
    $ftpu = "username here"; 
    $ftpp = "password here"; 
    $serv = "server name here"; 
    
    system("/bin/tar cfp - / | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv.tar.gz");
    cPanel.net Support Ticket Number:

  6. #6
    Member
    Join Date
    May 2003
    Posts
    47

    Default

    does it first uses that WHM backup in the same server them those backup are sent via FTP to the other server ?

    Or these script just make a backup itself and send to another server without having to use the WHM backup system.

    My question is because doing a backup to the same HD (WHM backup system) may cause a crash on it (I read it on the forums) and having 2 HD do not gives much security against hackers.

    So I would like to have 2 servers and both with accounts and one would be also a back up from one to another.

    So does your script these job or you recommend another stuff ?

    cPanel.net Support Ticket Number:

  7. #7
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    The script uses the backups that WHM creates to send to the other server. You need to have WHM either backup to the main harddrive or a second harddrive in order for the script to work.

    cPanel.net Support Ticket Number:

  8. #8
    Member
    Join Date
    May 2003
    Posts
    47

    Default

    is that a way to create the backup directly to the second server?

    cPanel.net Support Ticket Number:

  9. #9
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    If you change the script to:
    Code:
    #!/usr/bin/perl 
    
    #FTP Server Information here 
    $ftps = "ftp server name here"; 
    $ftpu = "username here"; 
    $ftpp = "password here"; 
    $serv = "server name here"; 
    
    system("/bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv.tar.gz");
    it'll backup all your files directly to the server - however, mysql databases won't be backed up. You could create a seperate script to accomplish this:
    Code:
    #!/usr/bin/perl 
    
    #FTP Server Information here 
    $ftps = "ftp server name here"; 
    $ftpu = "username here"; 
    $ftpp = "password here"; 
    $serv = "server name here"; 
    
    system("/bin/tar cfp - /var/lib/mysql | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv.tar.gz");
    and then upload that file along side that to the cron directory.

    IE: /etc/cron.daily/homebackup.pl and /etc/cron.daily/mysqlbackup.pl

    It's still better to use the WHM backups because they're rather well packed, but if you don't want to, do it as I wrote above.

    cPanel.net Support Ticket Number:

  10. #10
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    Wow this is good stuff and nicly explained...

    The only problem I see is recovering the back ups, does this allow the WHM recover options to work with the remote backups?

    If so I would be in a state of bliss

    If not can you explain how to recover a back up, for say one account.

    Thank you for this, good karme is due for you now..

    -Charles

    cPanel.net Support Ticket Number:

  11. #11
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    OK, here's how I backup an account. I login to the remote backup server (not your usual server) via ftp and download the file to my computer. I then open it using WinZip and extract everything to the directory of my choice. There should then be a tarball for each user. Now you have 2 choices:

    1) Open up the user of your choice using WinZip. Then extract that to a directory. Upload all the files back up to that user's account.

    2) Place the tarball in the /backup/daily directory and then choose to restore backup in WHM. Choose daily and then pick the user you want to restore.

    cPanel.net Support Ticket Number:

  12. #12
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    I was thinking you can wget the files from the ftp server from behind a password protected folder. Just download it right to the back up directory.

    Can you do a username and password when doing a wget command?

    And Unix pros?

    Thanks,

    cPanel.net Support Ticket Number:

  13. #13
    Member pirania1's Avatar
    Join Date
    May 2003
    Location
    Miami, FL
    Posts
    137

    Default

    erm...
    Code:
    http://username:password@server/directory/file.htm
    Nothing difficult here.

    cPanel.net Support Ticket Number:
    Last edited by pirania1; 06-11-2003 at 09:32 PM.

  14. #14
    cPanel Partner NOC cPanel Partner NOC Badge DWHS.net's Avatar
    Join Date
    Jul 2002
    Location
    LA, Costa RIca
    Posts
    1,356

    Default

    Wow brain freeze, I forgot about that

    cPanel.net Support Ticket Number:

  15. #15
    Member
    Join Date
    Jun 2003
    Posts
    129

    Default

    You wouldn't be able to wget the file directly from the server, well you could, but I don't think WHM could handle it - as it'll be a tarball of all the accounts, not just one. You would have to untar it on the remote server first to break it down to user.tar.gz - then you could use wget and WHM

    cPanel.net Support Ticket Number:

Similar Threads & Tags
Similar threads

  1. Incremental backup on remote server
    By TDD in forum Data Protection
    Replies: 12
    Last Post: 01-21-2011, 12:49 PM
  2. Replies: 10
    Last Post: 02-19-2010, 07:03 AM
  3. backup directly to a remote server
    By dbrock in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-15-2005, 08:50 PM
  4. backup to remote server?
    By jimjoe in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 05-26-2003, 12:10 AM
  5. There should be a Server Backup to remote
    By webkar in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-27-2003, 04:46 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube