SOLVED Additional Custom Backup Folder Selection?

BobHoliday

Member
Sep 6, 2013
23
3
53
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
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:

To configure system backups to include custom files or directories, create a new file or directory in the /var/cpanel/backups/extras directory (for example, /var/cpanel/backups/extras/etc). In that file, enter an absolute path to any files that you wish to back up (for example, /etc/example.conf).
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!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello @BobHoliday,

I'm glad to see that helped. I've marked this thread as solved.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
A quick PS... does the 'etc' file in your example accept wildcards? Eg

/etc/csf/*.allow

?
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.
 

Paulgeee

Member
Feb 22, 2019
6
0
1
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

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!
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
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.
 

Paulgeee

Member
Feb 22, 2019
6
0
1
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

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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
is there a way to include another top level folder within the backup directory i.e.

backup date..|
_________..|accounts
_________..|myfolder
_________..|system
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.