Difference between revisions of "How to backup settings of users and data of GUI by cron"

From VoIPmonitor.org
Jump to navigation Jump to search
(Created page with "The goal is to have config of users and GUI backuped (not contain CDR data) following example script '''/root/backupguicfg.sh''' will create 3 files per day in /root/guiconfi...")
 
 
Line 1: Line 1:
The goal is to have config of users and GUI backuped (not contain CDR data)
+
The goal is to have config of users and GUI backuped (not contain CDR data) each day.
  
 
following example script '''/root/backupguicfg.sh''' will create 3 files per day in /root/guiconfigs (dir needs to exists)
 
following example script '''/root/backupguicfg.sh''' will create 3 files per day in /root/guiconfigs (dir needs to exists)

Latest revision as of 00:15, 9 November 2018

The goal is to have config of users and GUI backuped (not contain CDR data) each day.

following example script /root/backupguicfg.sh will create 3 files per day in /root/guiconfigs (dir needs to exists)

#!/bin/bash
day=`date "+%Y-%m-%d"`
filecfgt=/root/guiconfigs/cfgtables-${day}.txt
filedata=/root/guiconfigs/cfgdata-${day}.txt
filecfgf=/root/guiconfigs/cfgfiles-${day}.txt
php /var/www/html/php/run.php backupGuiTables -t config -f $filecfgt
php /var/www/html/php/run.php backupGuiTables -t data -f $filedata
php /var/www/html/php/run.php backupGuiConfigurationFiles -f $filecfgf


and into /etc/crontab set to start the script at 3:30 daily (nighttime when load is low)

30 3 * * * root /root/backupguicfg.sh

Then reload cron daemon settings to accept new line:

kill - HUP `pgrep cron`

Beware that script jsut do the backups - you need to clean old configs yourself or extend the script.