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.

exclude from backup

Discussion in 'Data Protection' started by hostnex, Jul 12, 2015.

  1. hostnex

    hostnex Well-Known Member

    Joined:
    May 2, 2008
    Messages:
    77
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Islamabad, Pakistan, Pakistan
    cPanel Access Level:
    Root Administrator
    we want to exclude /home from daily and weekly cpanel automated backup process . Is there anyway to achive this task.
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello,

    Can you please let us know why you want to exclude entire /home directory from the cPanel backup process ?
     
  3. Wabun

    Wabun Well-Known Member

    Joined:
    Oct 6, 2012
    Messages:
    56
    Likes Received:
    2
    Trophy Points:
    8
    Location:
    Antwerpen
    cPanel Access Level:
    Root Administrator
    in /home are all your cpanel users accounts stored, unless you have them stored in other location, but you didn't mention that!
    if you don't want to backup then simple disable your backup config. Just read through the options, do you want only Monthly tick that!
     
  4. hostnex

    hostnex Well-Known Member

    Joined:
    May 2, 2008
    Messages:
    77
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Islamabad, Pakistan, Pakistan
    cPanel Access Level:
    Root Administrator
    actually we use r1soft for servers backup. R1soft can only restore files and folders but it can not restore whole cpanel struction. we want to keep cpanel acount stucture + mysql db. In case if account is deleted we can restore cpanel backup from weekly or monthly backup and restore files from R1soft... this is why we want to have cpanel backups without /home
     
  5. cPMatthewV

    cPMatthewV Quality Assurance Analyst
    Staff Member

    Joined:
    Apr 11, 2014
    Messages:
    21
    Likes Received:
    15
    Trophy Points:
    3
    Location:
    Houston, Tx
    cPanel Access Level:
    Root Administrator
    Hello,

    Unfortunately the Backup Configuration does not provide an option to disable backing up /home.

    You can however use the global /etc/cpbackup-exclude.conf file to exclude specific folders. This would have to list specific folders under the users /home/user directory such as public_html or mail and will not allow you to completely exclude the entire /home/user folder.

    http://documentation.cpanel.net/display/CKB/How+to+Exclude+Files+From+Backups

    If you really wish to exclude the entire /home/user directory you can use pkgacct and pass it it the --skiphomedir flag. The issue here is that you would have to create a custom script / cron to run this frequently and automatically, as well as have it setup to move the cpmove-user.tar.gz files out of /home and into a custom directory and sort by date, otherwise the cpmove files would be overwritten the next time the pkgacct script is ran.
    Code:
    /usr/local/cpanel/scripts/pkgacct --skiphomedir
    
    The following quick bash script could make the backups, create the backup directory if not already created and the backup date folder and then move the backups.
    Code:
    for user in `ls /var/cpanel/users|grep -v \/`
         do
             /scripts/pkgacct --skiphomedir $user;
             mkdir -p /backup/`date +%Y-%m-%d`;
             mv /home/cpmove-* /backup/`date +%Y-%m-%d`;
    done
    
    You just need to add a cron to run this nightly at say 1am.
    Code:
    0 1 * * * sh /root/custom-backup.sh
    
     
Loading...

Share This Page