Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

command line backup/restore scripts

Discussion in 'General Discussion' started by Goni, Oct 28, 2003.

Thread Status:
Not open for further replies.
  1. Goni

    Goni Member

    Joined:
    May 6, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    151
    Hi, I have to move an existing cpanel server data to another and was wondering if there are any command line backup/restore scripts available with the package. For some reasons, i can't access cpanel from web. So I have to stick for backup on console but can restore using both web/console.

    Are there any commands to backup all the contents, including email db, user's data and everything related to cpanel and restore it on the other server?


    Thanks,

    Goni
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. DHL

    DHL Well-Known Member

    Joined:
    Mar 8, 2002
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    306
    This should help, just comment anything you don't want/need.:

    #!/bin/sh
    # HOST = User + IP / Hostname to copy files from.
    # All files copied from remote HOST to the destinations on this server. Add IP below
    HOST="root@xxx.xxx.xxx.xxx"

    # Make sure to copy all system user/password files before anything else!!
    # /etc User / IP's + passwd files
    rsync -avz -e ssh $HOST:/etc/passwd /etc/
    rsync -avz -e ssh $HOST:/etc/shadow /etc/
    rsync -avz -e ssh $HOST:/etc/group /etc/
    rsync -avz -e ssh $HOST:/etc/wwwacct.conf /etc/
    rsync -avz -e ssh $HOST:/etc/quota.conf /etc/
    rsync -avz -e ssh $HOST:/etc/domainalias /etc/
    rsync -avz -e ssh $HOST:/etc/remotedomains /etc/
    rsync -avz -e ssh $HOST:/etc/reservedipreasons /etc/
    rsync -avz -e ssh $HOST:/etc/reservedips /etc/
    rsync -avz -e ssh $HOST:/etc/secondarymx /etc/
    rsync -avz -e ssh $HOST:/etc/localdomains /etc/
    rsync -avz -e ssh $HOST:/etc/userdomains /etc/
    rsync -avz -e ssh $HOST:/etc/valiases /etc/
    rsync -avz -e ssh $HOST:/etc/vfilters /etc/
    rsync -avz -e ssh $HOST:/etc/vmail /etc/
    rsync -avz -e ssh $HOST:/etc/trueuserdomains /etc/
    rsync -avz -e ssh $HOST:/etc/ips /etc/
    rsync -avz -e ssh $HOST:/etc/domainips /etc/
    rsync -avz -e ssh $HOST:/etc/services /etc/
    # ftpd files
    rsync -avz -e ssh $HOST:/etc/sysconfig/pure-ftpd /etc/sysconfig/
    rsync -avz -e ssh $HOST:/etc/pure-ftpd.conf /etc/
    rsync -avz -e ssh $HOST:/etc/pure-ftpd /etc/
    rsync -avz -e ssh $HOST:/etc/pureftpd-ldap.conf /etc/
    rsync -avz -e ssh $HOST:/etc/pureftpd-mysql.conf /etc/
    rsync -avz -e ssh $HOST:/etc/pureftpd-pgsql.conf /etc/
    rsync -avz -e ssh $HOST:/etc/proftpd /etc/
    rsync -avz -e ssh $HOST:/etc/proftpd.* /etc/
    # /var
    rsync -avz -e ssh $HOST:/var/cpanel /var/
    rsync -avz -e ssh $HOST:/var/spool/cron /var/spool/

    # /usr config - 3rdparty
    rsync -avz -e ssh $HOST:/usr/share/ssl /usr/share/
    rsync -avz -e ssh $HOST:/usr/local/cpanel/3rdparty /usr/local/cpanel/
    # Apache
    rsync -avz -e ssh $HOST:/usr/local/apache/conf/ /usr/local/apache/conf/
    rsync -avz -e ssh $HOST:/usr/local/frontpage /usr/local/

    # Mysql config
    rsync -avz -e ssh $HOST:/root/.my.cnf /root/
    rsync -avz -e ssh $HOST:/etc/my.cnf /etc/

    # Named
    rsync -avz -e ssh $HOST:/var/named /var/
    rsync -avz -e ssh $HOST:/etc/named.conf /etc/
    rsync -avz -e ssh $HOST:/etc/rndc.conf /etc/

    #cPanel
    rsync -avz -e ssh $HOST:/usr/local/cpanel/base/frontend /usr/local/cpanel/base/
    rsync -avz -e ssh $HOST:/usr/local/cpanel/lang /usr/local/cpanel/
    # Logs
    rsync -avz -e ssh $HOST:/usr/local/apache/domlogs/ /usr/local/apache/domlogs/
    rsync -avz -e ssh $HOST:/var/spool/exim/input/ /var/spool/exim/input/
    rsync -avz -e ssh $HOST:/var/spool/exim/msglog/ /var/spool/exim/msglog/
    rsync -avz -e ssh

    # Other mysql stuff
    rsync -avz -e ssh $HOST:/var/lib/mysql /var/lib/
    rsync -avz -e ssh $HOST:/var/lib/pgsql /var/lib/

    # /home
    rsync -avz -e ssh $HOST:/home/ /home/
     
  3. Goni

    Goni Member

    Joined:
    May 6, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    151
    Ok, this sounds great. I also have found, copy all accounts option under backup from the control panel. That copies all the info including everything and that sounds to be working fine.


    Naseer
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    694
    Likes Received:
    15
    Trophy Points:
    68
    Is there any cpanel console command which will backup configuration files?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Goni

    Goni Member

    Joined:
    May 6, 2003
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    151
    Hello Friend, You are posting a reply to a 9 year old thread !!! WOW, how did you find it? I am not sure about your question now, because since then cPanel has changed a lot. Would have to look into if you like. PM me if you need any help.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,477
    Likes Received:
    421
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Agreed, this thread is old and out of date. Many things have changed over the years. Please start a new thread, and feel free to link to this one as an example of what you seek if needed.

    Closing thread.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...
Thread Status:
Not open for further replies.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice