21 lines
950 B
Plaintext
21 lines
950 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
#version
|
||
|
version=$(/usr/bin/xmllint --xpath 'string(/module/version)' /opt/freepbx/admin/modules/backup/module.xml|cut -d. -f1)
|
||
|
#if version >=15
|
||
|
if [[ $version -ge 15 ]]
|
||
|
then
|
||
|
#backup id SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE 'backup_name' and `val` LIKE 'Default-backup';
|
||
|
backupid=$(echo 'SELECT `id` FROM `kvstore_FreePBX_modules_Backup` WHERE `key` LIKE "backup_name" and `val` LIKE "Default-backup"'| mysql -u root freepbxdb -s)
|
||
|
#if backupid empty need to set one of manually backup something
|
||
|
if [ -z $backupid ] ; then
|
||
|
echo "missing backupid, we create the db entries"
|
||
|
/etc/e-smith/events/actions/freepbx-checkinstall-backup pre-backup
|
||
|
fi
|
||
|
echo "backup for freepbx version 15 or above"
|
||
|
/usr/sbin/fwconsole bu --backup $backupid 1>/dev/null
|
||
|
else
|
||
|
echo "backup for freepbx version 14 or below"
|
||
|
su asterisk -s /bin/bash -c '/usr/sbin/php56 /var/lib/asterisk/bin/backup.php --id=1'
|
||
|
fi
|