summaryrefslogtreecommitdiff
path: root/byteback-mysql/pre-backup.d
diff options
context:
space:
mode:
authorSteve Kemp <steve@bytemark.co.uk>2016-09-21 12:27:06 +0100
committerSteve Kemp <steve@bytemark.co.uk>2016-09-21 12:27:06 +0100
commitc68fe975ab4b47436bd90fa701b83a78793b0f32 (patch)
tree99ba226baa3d2d7cdac0470a9af93650e2449be0 /byteback-mysql/pre-backup.d
parent2e96f802b1aa2cd374ef727c5573b30ab38001ce (diff)
parent10d3ddac7a625be28e9896f52bade5c99dc34462 (diff)
Merge branch 'byteback-mysql' into 'master'
Byteback mysql See merge request !3
Diffstat (limited to 'byteback-mysql/pre-backup.d')
-rwxr-xr-xbyteback-mysql/pre-backup.d/00-mysql31
1 files changed, 31 insertions, 0 deletions
diff --git a/byteback-mysql/pre-backup.d/00-mysql b/byteback-mysql/pre-backup.d/00-mysql
new file mode 100755
index 0000000..edfcd56
--- /dev/null
+++ b/byteback-mysql/pre-backup.d/00-mysql
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Data::Dumper;
+
+use lib '/etc/byteback/scripts.d';
+use Bytemyback::ini qw(readconf writeconf generateconf);
+
+# Shim script to determine which MySQL backup(s) to run if any
+
+my %config = Bytemyback::ini::readconf();
+if (!%config) {
+ %config = Bytemyback::ini::generateconf();
+}
+
+# Backup directory shouldn't be world-readable
+system("mkdir -p /var/backups/byteback");
+system("chmod 700 /var/backups/byteback");
+
+# List of each script to run (not mutually exclusive). Generated automatically if it doesn't exist
+
+my $backup_method = $config{'backup_method'};
+
+foreach my $method (keys %$backup_method) {
+ next unless $backup_method->{$method};
+ print "Running /etc/byteback/scripts.d/Bytemyback/${method} pre\n";
+ `/etc/byteback/scripts.d/Bytemyback/${method} pre` if (-x "/etc/byteback/scripts.d/Bytemyback/${method}");
+ print "Finished /etc/byteback/scripts.d/Bytemyback/${method} pre\n";
+}