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.

how to backup the home directory using ssh?

Discussion in 'General Discussion' started by sharmaine001, Nov 22, 2009.

  1. sharmaine001

    sharmaine001 Well-Known Member

    Joined:
    Jun 23, 2006
    Messages:
    143
    Likes Received:
    0
    Trophy Points:
    16
    I know i can back up the home directory of one account in cPanel, but is there a script like pkgacct that will backup only the home directory?
     
  2. sgriffin

    sgriffin Member

    Joined:
    Nov 15, 2003
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    tar -zcf /destination_dir/filename /home/account/public_html
    example:
    tar -zcf /home/account.tar.gz /home/account/public_html/

    extraction similar
    tar -zxf
     
  3. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    If you change the "z" to a "j" in sfgriffin's suggestion, you can use ".tar.bz2" for the archive which get's much tighter compression.

    Now if you are just wanting to archive the folder then creating an archive may work for you but Cpanel also has a few good scripts for this too:

    Code:
    /scripts/pkgacct  (login name goes here)
    
    This will make a complete backup of the entire account and drop the backup file in your /home folder on the server's hard drive.

    Filename: cpmove-(login).tar.gz

    With that file, you can re-create the entire account on any Cpanel server
    or restore it again on the same server should disaster strike ;)
     
  4. madaboutlinux

    madaboutlinux Well-Known Member

    Joined:
    Jan 24, 2005
    Messages:
    1,052
    Likes Received:
    2
    Trophy Points:
    38
    Location:
    Earth
    You can backup the home directories of all the accounts in a one go using the following command:

    for i in `cat /etc/trueuserdomains | awk '{print $2}'`; do tar -zcf /home/backup/$i.tar.gz /home/$i; done;

    but before executing the above command, create the backup directory under /home

    mkdir /home/backup
     
  5. jrianto

    jrianto Active Member

    Joined:
    Jun 9, 2008
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    You can also create a simple script using the API to just perform the home directory backup. Then run this script on your daily cron.
     
Loading...

Share This Page