What to Back Up
| Data | Location | Method |
|---|---|---|
| ICTCore config | /usr/ictcore/etc/ |
File copy |
| ICTCore DB | MariaDB ictfax |
mysqldump |
| ICTCore PBX DB | PostgreSQL fusionpbx |
pg_dump |
| FreeSWITCH config | /etc/freeswitch/ |
File copy |
| Recordings | /var/lib/freeswitch/recordings/ |
File copy |
| Voicemail | /var/lib/freeswitch/storage/voicemail/ |
File copy |
| Frontend build | /usr/ictpbxx/ |
File copy |
| Apache config | /etc/httpd/conf.d/ |
File copy |
| TLS certificates | /etc/letsencrypt/ |
File copy |
Backup Commands
MariaDB (ICTCore)
mkdir -p /backup
mysqldump -u root -p –single-transaction –routines ictfax > /backup/ictfax_$(date +%Y%m%d).sql
PostgreSQL (ICTCore PBX)
PGPASSWORD=”” pg_dump -h 127.0.0.1 -U fusionpbx fusionpbx > /backup/ictpbx_$(date +%Y%m%d).sql
FreeSWITCH config
tar czf /backup/freeswitch_$(date +%Y%m%d).tar.gz /etc/freeswitch/ /etc/httpd/conf.d/ /etc/letsencrypt/
Recordings & Voicemail
tar czf /backup/media_$(date +%Y%m%d).tar.gz /var/lib/freeswitch/recordings/ /var/lib/freeswitch/storage/voicemail/
Restore Commands
MariaDB
mysql -u root -p ictfax < /backup/ictfax_20240101.sql
PostgreSQL (ICTCore PBX)
Restoring into the live database fails. Stop FreeSWITCH and Apache first, drop and recreate the fusionpbx database, then restore and start everything again:
systemctl stop freeswitch httpd
# drop and recreate the fusionpbx database here
PGPASSWORD=”” psql -h 127.0.0.1 -U fusionpbx fusionpbx < /backup/ictpbx_20240101.sql
systemctl start httpd freeswitch
systemctl reload php-fpm
Recommended Schedule
| Backup | Frequency |
|---|---|
| Full DB dump | Daily, retain 7 days |
| Config files | Weekly |
| Recordings | Weekly or on-demand |
Tip: Automate with Cron
No backup script ships with ICTPBX, so you’ll write your own.
- Create
/usr/local/bin/ictpbx-backup.shwith the backup commands above. - Cron can’t answer a password prompt. In the script, drop
-pfrommysqldumpand put the MariaDB root password in the[client]section of/root/.my.cnfinstead. - Make the script executable:
chmod +x /usr/local/bin/ictpbx-backup.sh - Create
/etc/cron.d/ictpbx-backupwith this line, which runs it every night at 2am:
0 2 * * * root /usr/local/bin/ictpbx-backup.sh