New feature: change backup directory on-the-fly
Posted: 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:
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:
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,
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,