Excluding files from Freepbx backup


PIAF version, Freepbx version

I am trying to exclude the EPM modules from our PIAF server backup. Under:
Additional Files/Exclude files and folders, I have tried every permutation of:
that I can think of.

Can someone help me with the correct syntaxt to exclude that path and everything below it?


Bryan Hunt

Okay, after a lot of digging I have found the answer to this backup issue.

The bottom line is: it doesn’t work like that. At least, not the way that I thought that it did. And from what I have read in other posts, not the way a lot of other people think that it does either.

The basic steps behind the backup script (which is: ampbackup.php in /var/www/html/admin/modules/backup/bin), are to create a series of smaller tarballs for each of the selected options (CDR, Voicemail, System Recordings, etc), then to combine the smaller tarballs into one large tarball, which is the final backup file.

The “Additional Files/Additional files and folders” option allows a user to add files to the backup that are not normally included by the backup script. The “Exclude files and folders” options only excludes files that you included in the “Additional files and folders” section. It does not exclude files/folders across the entire scope of the backup, which is what I had assumed.

So, the only way to resolve my issue was to change the backup script to exclude the specific files when it is creating that particular smaller tarball. In my case, it was the ‘configurations’ tarball.

I changed line 130 of the backup script from:

$cmd=’/bin/tar -Pcz -f /tmp/ampbackups.’.$opts[‘now’].’/configurations.tar.gz ‘.$amp_conf[‘ASTVARLIBDIR’].’/agi-bin/ ';

$cmd=’/bin/tar -Pcz -f /tmp/ampbackups.’.$opts[‘now’].’/configurations.tar.gz
–exclude=/var/www/html/admin/modules/_ep_phone_modules/* ‘.$amp_conf[‘ASTVARLIBDIR’].’/agi-bin/ ';

Excluding those subdirectories cut my backup file size from 472MB to 50MB, which is where I need to be.


Bryan Hunt

I was not able to get it working either for my setup, I ended up ecluding the following which left the firmware behind.


I am also backing up the /tftpboot directory and excluding the following