summaryrefslogtreecommitdiff
path: root/byteback-mysql/post-backup.d/00-mysql
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2016-09-21 14:26:09 +0300
committerSteve Kemp <steve@steve.org.uk>2016-09-21 14:26:09 +0300
commitf61507920beeffa925c1dd13d76939e0352e2ae7 (patch)
treeb99cbb2a61e0d1f0f48dd11877df64b1371729cb /byteback-mysql/post-backup.d/00-mysql
parentbcfddd9c4bec12260abcdf105d918ff82a279794 (diff)
Import byteback-mysql scripts/files from jlawrie.
Diffstat (limited to 'byteback-mysql/post-backup.d/00-mysql')
-rwxr-xr-xbyteback-mysql/post-backup.d/00-mysql27
1 files changed, 27 insertions, 0 deletions
diff --git a/byteback-mysql/post-backup.d/00-mysql b/byteback-mysql/post-backup.d/00-mysql
new file mode 100755
index 0000000..72369bf
--- /dev/null
+++ b/byteback-mysql/post-backup.d/00-mysql
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use lib '/etc/byteback/scripts.d';
+use Bytemyback::ini qw(readconf writeconf generateconf);
+
+use Sys::Hostname;
+
+# Shim script to determine which MySQL backup(s) to run if any
+
+my %config = Bytemyback::ini::readconf();
+
+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} post\n";
+ `/etc/byteback/scripts.d/Bytemyback/${method} post` if (-x "/etc/byteback/scripts.d/Bytemyback/${method}");
+ print "Finished /etc/byteback/scripts.d/Bytemyback/${method} post\n";
+
+ # Each script should have a heartbeat alert. They may also have specific failure alerts on both client and
+ # server side.
+ my $host = hostname;
+ system("mauvesend -i $method-hb-${host}-low -c now -r +26h -s 'MySQL backup method $method on ${host} has not run for over a day' --detail='Please try running manually to see what the problem was, and check the mailing list'");
+}