Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Introduction

The following commands will work in FreePBX 15+

This page is for the new commands in FreePBX 15+, please see fwconsole commands (13+) for the existing fwconsole commands from FreePBX 13

Backup

List Backups

# fwconsole backup --list
fwconsole backup --backup=[Backup ID]
+-------------+-------------+--------------------------------------+
| Backup Name | Description | Backup ID                            |
+-------------+-------------+--------------------------------------+
| Test Backup | YOLO        | 2dad0248-ca89-43a3-b761-82848399d903 |
+-------------+-------------+--------------------------------------+

Run Backup

# fwconsole backup --backup=2dad0248-ca89-43a3-b761-82848399d903
Starting backup job with ID: d560ee22-1765-4b87-96a7-ef6fbc0e9c7c
2017-09-20T08:34:07-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Running pre backup hooks
2017-09-20T08:34:07-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Starting backup Test_Backup
2017-09-20T08:34:07-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - This backup will be stored locally at /var/spool/asterisk/backup/Test_Backup/backup-1505921647.tar and is subject to maintinance settings
2017-09-20T08:34:12-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Saving to selected Filestore locations
2017-09-20T08:34:14-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Cleaning up
2017-09-20T08:34:16-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Running post backup hooks
2017-09-20T08:34:16-07:00 [d560ee22-1765-4b87-96a7-ef6fbc0e9c7c] - Backup completed successfully

Dump Backup job for remote

fwconsole backup --dumpextern=2dad0248-ca89-43a3-b761-82848399d903

Run backup with remote string and custom transaction id

backup --externbackup='BASE64STRING' --transaction='transactionstring'
#will output transactionstring.tar.gz

Restore Legacy CDR using command line 

fwconsole backup --restore /home/20200109-110433-1578548073-14.0.13.23-818337824.tgz --restorelegacycdr
Transaction ID is: 76bbbff3-c47f-4b5f-b5ca-e922e230cba9
Determining backup file type...type is legacy
Legacy CDR Restore Option: 1
Starting restore job with file: /home/20200109-110433-1578548073-14.0.13.23-818337824.tgz
Extracting backup...

Restore Legacy Backup using in-file-db(sqlite) instead of in-memory via command line (--useinfiledb)

This recommended only for Legacy Heavy backup which can cause memory issue shown below And this option (--useinfiledb) will make the restore process very  slow

proc_open(): fork failed - Cannot allocate memory on line 523 of file /var/www/html/admin/libraries/BMO/GPG.class.php
#0 [internal function]: Whoops\Run->handleError(2, 'proc_open(): fo...', '/var/www/html/a...', 523, Array)
#1 /var/www/html/admin/libraries/BMO/GPG.class.php(523): proc_open('/usr/bin/gpg2 -...', Array, NULL, '/tmp', Array)

 This kind restore is possible only via command line , And the option you need to pass is --useinfiledb

fwconsole backup --restore /home/20200109-110433-1578548073-14.0.13.23-818337824.tgz --useinfiledb
Transaction ID is: 76bbbff3-c47f-4b5f-b5ca-e922e230cba9
Determining backup file type...type is legacy
Starting restore job with file: /home/20200109-110433-1578548073-14.0.13.23-818337824.tgz
Extracting backup...
Legacy Restore is using file based sqlite
Loading manifest to memory
Loading astdb to memory
Utilizing file based sqlite at /tmp/76bbbff3-c47f-4b5f-b5ca-e922e230cba9.db, This is SLOW

Backup and Restore config for a Single Module

Using the args,, --backupsingle and --restoresingle, it's possible to create and restore backups for just a single module for testing or other purposes.

fwconsole backup --backupsingle [modulename] --singlesaveto /some/path/foo.tgz
fwconsole backup --restoresingle /some/path/foo.tgz

Backup Example

[root@freepbx ~]# fwconsole backup --backupsingle ivr --singlesaveto /var/spool/asterisk/backup
Transaction ID is: d2c3c894-4c68-49eb-827f-cbc1d899967d
Processing ivr
Working with ivr module
        Adding module manifest for ivr
***In single restores mode dependencies are NOT processed***
There was nothing to cleanup
Finished created backup file: /var/spool/asterisk/backup/ivr-20220615-065909-1655290749-15.0.29-180725149.tar.gz
Backup completed successfully

Restore Example

[root@freepbx ~]# fwconsole backup --restoresingle /var/spool/asterisk/backup/ivr-20220615-065909-1655290749-15.0.29-180725149.tar.gz
Transaction ID is: c22156c1-1da1-40f7-b49a-7d3a0bccd2f2
Extracting backup...
***In single restores mode dependencies are NOT processed***
Resetting ivr module data
Dropping table ivr_entries...Done
Dropping table ivr_details...Done
Updating tables ivr_entries, ivr_details...Done
Generating CSS...Done
Restoring from ivr [FreePBX\modules\Ivr\Restore]
Done
Finished
Restore completed successfully

Core

Convert Legacy chan_sip extensions to chan_pjsip

To convert all chan_sip extensions to chan_pjsip

fwconsole convert2pjsip --all
fwconsole reload

To convert specific chan_sip extensions to chan_pjsip you can specify each one separated by a comma. (Example: 6020, 6030, 6040)

fwconsole convert2pjsip -r 6020,6030,6040
fwconsole reload

You can also specify a range of extensions (Example: 5000 through 5100 and 6020 through 6040)

fwconsole convert2pjsip -r 5000-5100,6020-6040
fwconsole reload

Note: Use `fwconsole reload` to reload the config in FreePBX

Module Admin

Skip "breaking" checks when installing modules that is deprecated or has conflicts

This will skip checks for all modules

fwconsole ma install foomodule --skipbreakingcheck

For a specific module

fwconsole ma install foomodule barmodule --skipbreakingcheck=foomodule

For multiple specified modules

fwconsole ma install foomodule barmodule bazmodule --skipbreakingcheck=foomodule,barmodule

Installing specific module versions with multiple modules

fwconsole ma install foomodule:15.1.3 barmodule:15.0.9

Certificate Manager

Generate LE Certificate from CLI

# fwconsole ma list | grep cert
| certman             | 15.0.34    | Enabled                           | AGPLv3+     |
 
 
# fwconsole certificates --generate --type=le --hostname=xyz.redacted.com  --country-code=ca --state=ns --email=xyz@redacted.com
Getting list of URLs for API
Requesting new nonce for client communication
Account already registered. Continuing.
Sending registration to letsencrypt server
Sending signed request to https://acme-v02.api.letsencrypt.org/acme/new-acct
Account: https://acme-v02.api.letsencrypt.org/acme/
Starting certificate generation process for domains
Requesting challenge for xyz.redacted.com
... bunch of lines removed ...
Got certificate! YAY!
Saving fullchain.pem
Saving cert.pem
Saving chain.pem
Done !!
Successfully installed Let's Encrypt certificate 'xyz.redacted.com'
  • No labels