How to backup settings of users and data of GUI by cron

Jump to navigation Jump to search

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

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

day=`date "+%Y-%m-%d"`
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/

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.