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.

Backup in 2 FTP Remote Servers

Discussion in 'Data Protection' started by scrawny, Jun 12, 2010.

  1. scrawny

    scrawny Registered

    Joined:
    Jun 12, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    I need to do a full Backup of all accounts in two remote FTP servers, but WHM only allows me to do in one FTP server (Backup --> Configure Backup ...)

    Does anyone how to do it? Any script?

    cPanel 11.25.0-S46156 - WHM 11.25.0 - X 3.9
    CENTOS 5.5 i686

    Thanks
     
  2. garrettp

    garrettp Well-Known Member
    PartnerNOC

    Joined:
    Jun 18, 2004
    Messages:
    312
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    cPanel only currently has support for backing up to one FTP server using the built-in backups. You can, however, fashion something using the /scripts/postcpbackup script which the main cpbackup routine hooks at the end of a successful backup. You could use this, for instance, to trigger a job on the backup FTP server to copy the fresh backups to the secondary, or to trigger a new cpbackup run against a different cpbackup.conf configuration file.
     
  3. scrawny

    scrawny Registered

    Joined:
    Jun 12, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Fixed

    Hi and thanks for your answer garrettp. You gave me a good idea and I have already solved the issue.
    As you say WHM can support only one and remote FTP Backup. Then do a second Backup process is not a good idea (too cpu usage)

    Steep 1
    WHM Bakup Standard in local (not Remote FTP)
    Steep 2
    Copy all Backup accounts to Remote FTP Server 1 (my server)
    Steep 3
    Copy all Backup accounts to Remote FTP Server 2 (friend server)
    ·
    ·
    ·

    I created this scrip to copy files to a remote server manually or automatically

    Code:
    #!/bin/sh
    MYSITE=$1
    echo $MYSITE
    ftp -n << EOF
    open $MYSITE
    user user_name passwword   #FTP username and pass
    bin            #transfer mode, binary
    hash           #optional, progress bar if execute manually, you can comment if use in crontab
    cd /           #remote dir to put or get files
    lcd /          #local dir to put or get files, neccesary in crontab
    put file1.txt  #copy local file1.txt to remote FTP server
    get file2.txt  #copy remote file2.txt to local server
    prompt         #prompting is turned off (default is on), any mget or mput will transfer all files without confirmation
    mput *.log     #copy all local .log files to remote FTP server
    mget *.dat     #copy all remote .dat files to local server
    bye            #exit ftp connection
    chmod 700 ftpscript

    How to execute manually:
    my script
    Code:
    #!/bin/sh
    MYSITE=$1
    echo $MYSITE
    ftp -n << EOF
    open $MYSITE
    user myusername mypass
    bin
    hash
    cd /securedir
    prompt
    mput *.tar.gz
    bye
    Code:
    [root@xs daily]# ./ftpscript host_or_ip
    How to crontab:
    my script

    Code:
    #!/bin/sh
    MYSITE=$1
    echo $MYSITE
    ftp -n << EOF
    open $MYSITE
    user myusername mypass
    bin 
    cd /securedir
    lcd /backup/cpbackup/daily
    prompt
    mput *.tar.gz
    bye
    edit crontab

    Code:
    [root@xs daily]# crontab -e
    add line

    Code:
    30 22 * * * /home/myscripts/ftpscript remote.ftp.server1
    Execute automatically every day at 22:30
     
  4. syslint

    syslint Well-Known Member

    Joined:
    Oct 9, 2006
    Messages:
    249
    Likes Received:
    6
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Also you need to adjust the time for copying the backups to second server. Think about starting second backup before finishing first backup :)
     
Loading...

Share This Page