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!

SOLVED Additional Custom Backup Folder Selection?

Discussion in 'Data Protection' started by BobHoliday, Nov 14, 2018.

Tags:
  1. BobHoliday

    BobHoliday Member

    Joined:
    Sep 6, 2013
    Messages:
    23
    Likes Received:
    3
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    I would like to include additional folders in the 'system' backups.

    In the case of a total loss of my server, and then having to start from scratch with "only" a full WHM backup, there'd be a lot of work to do re-creating config files and any other customisations I'd made to a standard Linux/WHM server build.

    Eg it'd be nice to backup /etc/csf.conf but WHM is not doing so I don't think.

    Is there some config file where I can add locations to the 'system' backup?

    Or is there perhaps a way to symlink from an existing system backup directory to another directory I want included?

    Or do I need to set up a cron to tar some stuff and stick it somewhere that will get backed up, and schedule that to run prior to the start of my backups?

    Or some other cunning way?

    TY
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @BobHoliday,

    Including custom files or directories with system backups is supported. We document how to do this at:

    System Backups - Custom Files

    Per the description:

    For example, if you wanted to include the /etc/csf.conf file with system backups, you'd create the
    /var/cpanel/backups/extras/etc file and populate it with a line like this:

    Code:
    # cat /var/cpanel/backups/extras/etc
    /etc/csf.conf
    Let me know if you have any questions about how this works.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. BobHoliday

    BobHoliday Member

    Joined:
    Sep 6, 2013
    Messages:
    23
    Likes Received:
    3
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Bravo. Thank you :)
     
    cPanelMichael likes this.
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @BobHoliday,

    I'm glad to see that helped. I've marked this thread as solved.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. BobHoliday

    BobHoliday Member

    Joined:
    Sep 6, 2013
    Messages:
    23
    Likes Received:
    3
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    A quick PS... does the 'etc' file in your example accept wildcards? Eg

    /etc/csf/*.allow

    ?
     
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Wildcards are not supported. You'll need to use the full path to each individual file, or enter the full directory path like this:

    Code:
    /etc/csf
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Paulgeee

    Paulgeee Registered

    Joined:
    Feb 22, 2019
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    gloucestershire
    cPanel Access Level:
    Root Administrator
    Hello
    Would that include entire directories i.e (if I included a new directory in the root called /myfolder ?)

    Code:
    # cat /var/cpanel/backups/extras/etc
    /myfolder/
    or would I add /myfolder/* to include everything?

    Thanks

     
    #7 Paulgeee, Feb 25, 2019
    Last edited: Feb 25, 2019
  8. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Paulgeee,

    Here's how the line would look in /var/cpanel/backups/extras/custom-filename if you wanted to backup the entire /myfolder directory:

    Code:
    /myfolder
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. Paulgeee

    Paulgeee Registered

    Joined:
    Feb 22, 2019
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    gloucestershire
    cPanel Access Level:
    Root Administrator
    Hello and thank you, I tried this out and it works a treat :)

    I noticed that it includes the tar backup in the /system/dirs/myfolder.gz directory.

    top levels being "system and accounts"

    is there a way to include another top level folder within the backup directory i.e.

    backup date..|
    _________..|accounts
    _________..|myfolder
    _________..|system

    I am trying to automate specific folders rather than individual files, I can create a separate script to do this but would rather rely on existing machine software.

    Thanks for your help
    Paul

     
  10. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,009
    Likes Received:
    2,123
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Paulgeee,

    There's no supported way to do this directly, but you could setup a custom script to run automatically before or after each backup run as part of a hook:

    Guide to Standardized Hooks - Developer Documentation - cPanel Documentation
    Guide to Standardized Hooks - PkgAcct Functions - Developer Documentation - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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