Results 1 to 6 of 6

Thread: command line backup/restore scripts

  1. #1
    Member
    Join Date
    May 2003
    Posts
    11

    Default command line backup/restore scripts

    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
    Hosting with a Digital Style
    URL http://www.digitallinx.com
    ICQ 23280942
    Voice +92-300-8449347

  2. #2
    DHL
    DHL is offline
    Member
    Join Date
    Mar 2002
    Posts
    88

    Default

    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. #3
    Member
    Join Date
    May 2003
    Posts
    11

    Default

    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
    Hosting with a Digital Style
    URL http://www.digitallinx.com
    ICQ 23280942
    Voice +92-300-8449347

  4. #4
    Member
    Join Date
    Oct 2010
    Posts
    79

    Default Re: command line backup/restore scripts

    Is there any cpanel console command which will backup configuration files?

  5. #5
    Member
    Join Date
    May 2003
    Posts
    11

    Default Re: command line backup/restore scripts

    Quote Originally Posted by postcd View Post
    Is there any cpanel console command which will backup configuration files?
    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.
    Hosting with a Digital Style
    URL http://www.digitallinx.com
    ICQ 23280942
    Voice +92-300-8449347

  6. #6
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    10,067
    cPanel/WHM Access Level

    Root Administrator

    Default Re: command line backup/restore scripts

    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.

Similar Threads

  1. restorepkg to restore to a specified (different) username [Case 56108]
    By tian in forum Feature Requests for cPanel & WHM
    Replies: 6
    Last Post: 04-18-2012, 11:29 AM
  2. Replies: 3
    Last Post: 04-19-2011, 10:58 AM
  3. Reconfigure backup via command line
    By anzenketh in forum Data Protection
    Replies: 2
    Last Post: 08-24-2010, 09:46 PM
  4. Replies: 1
    Last Post: 01-29-2010, 09:04 AM