Backup/Restore - Just capture certain file types?

I was hoping there was a way to have a list of “includes”, not just “excludes” within the Backup/Restore module. For example, I want to backup the /tftpboot/ directory, but ONLY the .xml and .cfg files.

My initial thought was to make it backup the directory “/tftpboot/*.xml”, but that didn’t seem to work. I’d hate to have to exclude everything else - is there any way to do it the way I’m wanting (just to list the file extensions of files to include)?

Thanks.

No one had any thoughts on this?

Perhaps backup the directory /tftpboot and add exclusions for the files you don’t want to backup ?

I had thought of that, but there are far more exclusions than desired file types - I was hoping there was a way to kinda do a reversal of that. :frowning:

In the specific case of the /tftpboot directory, I’d think you’d want to back that up completely. If there’s anything in there that you don’t need, you should remove it from the directory… TFTP presents enough security risks on its face without adding the possibility of having files you don’t actually need being in the directory.

In the general case - backing up everything and excluding a few specific file types is a common way )some would argue, THE common way) to do this. I can’t think of a way to specify an inclusive list, but you can submit a Feature Request through the Issues tab and see what the developers are willing to do.

Just paste the output of

for i in $(ls /tftpboot/);do echo *.${i##*.};done|sort -u |grep -Ev "xml|cfg"

into the exclusions box.

1 Like

Well, off the top of my head, all the firmware bundles I don’t want to backup, and each model has different file Extensions. Dicko - that certainly does make it easier - thank you!

Question - the output, if I’m reading it right, equates to individual filenames, not directories (for example: anyfilename.grandstream or anyfilename.ringtones). Would it not actually be:
/digium
/firmwaredownloads

or something like that?

I ask because the backup is taking forever, when it should be relatively quick - even the phase where it makes the file is taking quite a bit of time.

Just run similar code in each directory

for i in $(ls /tftpboot/digium/);do echo digium/.${i##.};done|sort -u |grep -Ev "xml|cfg"
for i in $(ls /tftpboot/firmware/);do echo firmware/.${i##.};done|sort -u |grep -Ev “xml|cfg”

but the firmware directory could probably be excluded en masse

So, if I understood the output correctly, my Exclusion list would look something like this?
=======
digium/.*
firmwaredownloads/.*
grandstream/.*
ringtones/.*
sangoma/.*
=======

Sorry, it’s just the exclusion syntax has always gotten the better of me…

No, you need to replace the * with the non xml|cfg files

Is there any way to basically say only do the folder mentioned in backup and exclude all nested folders/files? Meaning, it would do the root of the TFTPBOOT directory, but ignore all folders within that? That’s really what I’d want because as you add more brands to endpoint manager, it creates additional subdirectories that you’d have to call out as well.

Easily, just exclude in the tftpboot directory

*/*

1 Like

This really isn’t my day. lol

I tried:

Type:            Path:                       Exclude:
Directory      /tftpboot                   *.*
as well as
Directory .    /tftpboot/                  *.*

Neither seemed to do it (still took forever to run the backup, which it shouldn’t have with only 20-some phone configs in the directory).

I’m about to pull what little hair I have out. :slight_smile:

There is a very big difference between your

*.*

and my suggested

*/*

What else do you have in this particular backup ?

Sorry, I typed it wrong - it was a slash.

Because it’s a test, it’s ONLY that folder (rather than edit an existing for tests)

specifically exclude directories

digium
sangoma
.
.
.

then as previously , exlude non cfg|xml

So I just looked at the screenshot I took when I went to add that post - sure enough, it was star dot star (not star slash star) when I entered it. Working perfectly

Thanks Dicko

One other question. I just found out that custom.conf files aren’t part of the normal backup/restore apparently (specifically when doing it for a warm standby, so I wanted to create a line item that captured them.

This is what I tried:
DIRECTORY = /etc/asterisk/custom.conf
and (also tried each one individually)
DIRECTORY = /etc/asterisk/*custom.conf

Instead, it grabbed all BUT the “custom” files. lol.

neither of the files you use are DIRECTORY’s the first is a file, the second a file mask to exclude them, well, I thought we covered that :slight_smile:

but the file mask should be /path/*.conf