Scheduled restore from FreePbx

Hi !

First of all i’d like to say hello to everyone since I’m new to this forum. I am currently working for a growing company developing IP telephony solutions based on Free PBX.

Things are going pretty well. I am working on an automatic backup/restore solution between the main and the failover server. I’d like to know if there was a way to schedule automatic restore on a freepbx installation ? Here’s my setup:

  • HOST A = Main server
    –> Backup done everyday and sent through FTP on the backup server

  • Backup server = Basic CentOS with FTP server

  • HOST B = Failover server
    –> ** I want to schedule restoration from the backup server here

I don’t know if this setup is done correctly but i’m open to any suggestion. Thanks for your help.

This here…

Hello jfinstrom,

Actually this setup seems to explain how to configure automatic backup from one freepbx to another through SSH, but my main consern stay the same, there is no automatic restoration done ? Or am I wrong ? Does SSH backup actually backup to the second server directly without creating an archive and putting all files at its right place ?

Yes it uses SSH and the backup server connects to the production server. Does a backup and restores it on the backup sever as outlined very thoroughly in the wiki James posted.

Oh ok then it’s worth to give it a try…So I guess my idea of centralize all backup on a FTP server wouldn’t stand is the case i also want automatic restoration. Thanks for your answers.

Pragmatically, run the restore you want on the machine you set the backup on and grab the process that is actually running with:-

ps ax|grep restore.php

you will see something like:-

php /var/lib/asterisk/bin/restore.php --restore=/var/spool/asterisk/backups/daily/something --items=YToyOntzOjg6InNldHRpbmdzIjtzOjQ6InRydWUiO3M6NToiZmlsZXMiO2E6MTp7aTowO3M6NDoiL3ZhciI7fX0

the actual items to restore are base64 hashed to that stream of “nonsense” and would be like

to restore any backup file then from your shell:-


php /var/lib/asterisk/bin/restore.php --restore=${FILE} --items=${ITEMS}

I never bothered to decipher the actual syntax of “ITEMS”

Obviously you can get the latest “FILE” with

FILE=$(ls -rt ${DIR}*.tgz|tail -1) where DIR is the directory containing the backups you want