From 2b1bef911028f6adcabe4aa8d457fbf29d5056d2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 13 Jun 2015 19:00:55 +0000 Subject: [PATCH] wip --- unit-files/backup@.service | 2 ++ utils/spread_backups.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 utils/spread_backups.sh diff --git a/unit-files/backup@.service b/unit-files/backup@.service index 29da134..23ce0ae 100644 --- a/unit-files/backup@.service +++ b/unit-files/backup@.service @@ -8,6 +8,8 @@ EnvironmentFile=/etc/environment ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin ibuildthecloud/systemd-docker ExecStartPre=-/usr/bin/docker kill mysqldump-%i ExecStartPre=-/usr/bin/docker rm mysqldump-%i +ExecStartPre=-/usr/bin/docker rm clean-%i +ExecStartPre=-/usr/bin/docker rm backup-%i ExecStartPre=/bin/bash -euxc ' \ /bin/docker run \ --rm \ diff --git a/utils/spread_backups.sh b/utils/spread_backups.sh new file mode 100755 index 0000000..5647822 --- /dev/null +++ b/utils/spread_backups.sh @@ -0,0 +1,20 @@ +#!/bin/bash -eux + +for unit in `systemctl list-units --all backup@*service | grep "Back up data" | cut -d" " -f2 | grep backup | sort -R` +do + systemctl stop $unit + systemctl restart $unit +done + +for unit in `systemctl list-units --all backup@*service | grep "Back up data" | cut -d" " -f3 | grep backup | sort -R` +do + systemctl stop $unit + systemctl restart $unit +done + +for unit in `systemctl list-units --all backup@*service | grep "Back up data" | cut -d" " -f1 | grep backup | sort -R` +do + systemctl stop $unit + systemctl restart $unit +done +