Restore from a back up

Note this is a continuation from HELP PBX - maxed out my replies.

If my system is crashed and it is running 13 and I have a possibly incomplete 13 backup and a complete 12 backup - how do i go about restoring? I can’t get access to the web gui.

Can i restore via SSH? And try and restore the last 13 backup? Or do I have to wipe the server and do a clean install of 12 or 13 and then back up via web gui?

How do I get my back-ups off the server so they don’t get wiped before doing a clean install if that is the route to follow? I use free pbx hosting.com so they have a selection in their portal to do a clean install.

Are you able to SSH into the node. If so, go into the file structure and copy your last good backups to another computer on the network. I like using cyberduck for file transfer.

On a v13 machine run and read the output of

/var/www/html/admin/modules/backup/bin/restore.php

on older versions, I believe you can also use that script.

You are pretty well constrained to use the backup generated on the same version, as database structures and more evolve. If you look at the contents of the .tgz file however you will better understand how the backup/restore system works and perhaps even use it as a guide for what you need to manually set-up your new machine if you look into what was put in the ./etc/ folders in the tgz.

When I type that command:

/var/www/html/admin/modules/backup/bin/restore.php

I get

Whoops\Exception\ErrorException: file(/etc/asterisk/asterisk.conf): failed to open stream: No such file or directory in file /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php on line 418
Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php:418
  2. Whoops\Run->handleError() :0
  3. file() /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php:418
  4. FreePBX\Freepbx_conf->parse_amportal_conf() /var/www/html/admin/bootstrap.php:179
  5. require_once() /etc/freepbx.conf:9
  6. include() /var/www/html/admin/modules/backup/bin/restore.php:7
    [root@vps1410533580 DougSSHUser]# /var/www/html/admin/modules/backup/bin/restore.php
    Whoops\Exception\ErrorException: file(/etc/asterisk/asterisk.conf): failed to open stream: No such file or directory in file /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php on line 418
    Stack trace:
  7. Whoops\Exception\ErrorException->() /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php:418
  8. Whoops\Run->handleError() :0
  9. file() /var/www/html/admin/libraries/BMO/Freepbx_conf.class.php:418
  10. FreePBX\Freepbx_conf->parse_amportal_conf() /var/www/html/admin/bootstrap.php:179
  11. require_once() /etc/freepbx.conf:9
  12. include() /var/www/html/admin/modules/backup/bin/restore.php:7

You have to do that on a fully functioning machine

How can I know if one of my 13 back-ups is complete?

The last one I got emailed about - the drive filled up - I got

Backup completed with errors… This was the email I got…

February 26, 2017, 12:00 am - Backup Lock acquired!
February 26, 2017, 12:00 am - Running pre-backup hooks…
February 26, 2017, 12:00 am - Adding items…
February 26, 2017, 12:08 am - Backup failed dumping SQL database [asteriskcdrdb] to file [/var/spool/asterisk/tmp/backup-4/mysql-4.sql], you have a corrupted backup from server [localhost].
February 26, 2017, 12:17 am - Building manifest…
February 26, 2017, 12:17 am - Creating backup…
February 26, 2017, 12:17 am - Storing backup…
February 26, 2017, 12:17 am - Error copying /var/spool/asterisk/tmp/20170226-000016-1488085216-13.0.190.12-151571410.tgz to /var/spool/asterisk/backup/Feb_2016/20170226-000016-1488085216-13.0.190.12-151571410.tgz:
February 26, 2017, 12:17 am - Running post-backup hooks…
February 26, 2017, 12:17 am - Backup completed with errors!

When I look at then directory of backups I see this:

[root@vps1410533580 backup]# ls -d */
Default_backup/ Feb_2016/ March_12_2015/ OCT_28_2014/

I got an email from asterisk last may 1 saying the backup was successful (but older system of asterisk - I think 12 or 11) How do I even know which version of asterisk the back up was from? And why isn’t that on the list? And what is default back up?

You are outof luck on that file, it is corrupt and contains nothing usable.

I found the .tgz file on the server from May 1 which is 5.6mb which corresponds to this email I got:

May 1, 2016, 12:01 am - Backup Lock acquired!
May 1, 2016, 12:01 am - Running pre-backup hooks…
May 1, 2016, 12:01 am - Adding items…
May 1, 2016, 12:01 am - Backup Lock acquired!
May 1, 2016, 12:01 am - Running pre-backup hooks…
May 1, 2016, 12:01 am - Adding items…
May 1, 2016, 1:09 am - Bulding manifest…
May 1, 2016, 1:09 am - Creating backup…
May 1, 2016, 1:10 am - Storing backup…
May 1, 2016, 1:10 am - Bulding manifest…
May 1, 2016, 1:10 am - Running post-backup hooks…
May 1, 2016, 1:10 am - Backup successfully completed!

Does that look like it could be a whole backup – small office - maybe 12 phones - music on hold. 5 trunks

Yep looks ok, juat restore it to freepx of the same generation

Looks good. @dicko is right - you can use it to restore configuration on the FreePBX - same generation.
For example I have FreePBX distro 13 box with at about 30 extensions and 5 trunks (no music on hold yet :)) and the my full backup (without backup calls and voicemails) is 1004357 KB, which is roughtly 1 Meg.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.