New feature: change backup directory on-the-fly

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

New feature: change backup directory on-the-fly

Postby ccabrera » Tue Sep 29, 2015 4:45 am

Some of my clients have contracts which require always having a backup of the Vicidial system in case anything goes very, very wrong.

If I do a regular complete backup, it can go over 1 GB, which can be sometimes hard to transfer to a remote server, so what I need is the option to specify different kinds of backups so that I can rsync some of them, but not all. For example:

/var/log/astguiclient - Regular, full size backups
/var/log/astguiclient-light - Backup only the DB without the logs nor web content

Currently I can't find an option in the ADMIN_backup.pl script to choose where I want to save the backups, so if I select the "light" one, I would overwrite the last full backup I just had.

So in order to accomplish this, I decided to modify the backup script and add some lines. Here I put them in diff format:
Code: Select all
--- ADMIN_backup.pl   2015-09-29 04:26:41.000000000 -0500
+++ ADMIN_backup.pl.new   2015-09-29 04:29:48.000000000 -0500
@@ -65,6 +65,7 @@
       print "  [--debug] = debug\n";
       print "  [--test] = test\n";
       print "  [--db_raw_files_copy] = if set the backup won't be a mysql dump. It will tar the /var/lib/mysql folder. WARNING, THIS OPTION WILL STOP THE MYSQL SERVER!\n";
+      print "  [--archive_path] [<path>] = absolute path to store the resulting backup\n";
       exit;
       }
    else
@@ -139,9 +140,10 @@
          $ftp_transfer=1;
          print "\n----- FTP transfer -----\n\n";
          }
-      if ($args =~ /--db_raw_files_copy/i)
+      if ($args =~ /--archive_path ([^ ]*)/i)
          {
-         $db_raw_files_copy = 1;
+         $ARCHIVEpath = $1;
+         print "\n----- Archive path set to $ARCHIVEpath -----\n\n";
          }
       }
    }


What this patch does is modify the ADMIN_backup.pl script:
- Add a --archive_path option, which allows you to choose the saving path for this run. Like this:
Code: Select all
/usr/share/astguiclient/ADMIN_backup.pl --archive_path /var/vicibackup_light --db-without-logs --without-sounds --without-web


This way, you can setup different crons for different kinds of backups, and each can be stored in different directories.

I just added this to the tracker as ID 896. Hope it makes it to the trunk.

Regards,
Christian Cabrera
Enlaza Comunicaciones - Vicidial Partner
Mexico City
ccabrera
 
Posts: 153
Joined: Fri Jan 14, 2011 7:53 pm
Location: Mexico City

Re: New feature: change backup directory on-the-fly

Postby mflorell » Tue Sep 29, 2015 7:43 am

Thank you very much for posting this!

I'll try to take a look at it later this week.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 96 guests