From 7b2ec509be2266c4c9f42727e7db4e7fdd63b7ae Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 29 Apr 2019 13:39:47 -0400 Subject: [PATCH] avoid multiple time zones --- btrbk-run | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/btrbk-run b/btrbk-run index 50106a2..f0f16bd 100644 --- a/btrbk-run +++ b/btrbk-run @@ -245,9 +245,15 @@ EOF -for tg in ${targets[@]:-$HOSTNAME}; do - # for an initial run, btrbk requires the dir to exist. - ssh root@$tg mkdir -p /mnt/root/btrbk +# for an initial run, btrbk requires the dir to exist. +mkdir -p /mnt/root/btrbk +local_zone=$(date +%z) +for h in ${targets[@]} $source; do + zone=$(ssh root@$h "mkdir -p /mnt/root/btrbk; date +%z") + if [[ $zone != $local_zone ]]; then + echo "error: error. dont confuse yourself with multiple time zones. $h has different timezone than localhost" >&2 + exit 1 + fi done -- 2.30.2