-for tg in ${targets[@]}; do
- cat >/etc/btrbk.conf <<'EOF'
-ssh_identity /root/.ssh/id_rsa
-transaction_syslog daemon
+if [[ $source ]]; then
+ if ! zone=$(ssh root$source date +%z); then
+ die failed to ssh to root@$source
+ fi
+ if [[ $zone != $local_zone ]]; then
+ die "error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
+ fi
+
+else
+
+ sshable=()
+ sshfail=()
+ for h in ${targets[@]}; do
+ if zone=$(ssh root@$h "mkdir -p /mnt/root/btrbk && date +%z"); then
+ sshable+=($h)
+ else
+ sshfail+=($h)
+ fi
+ if [[ $zone != $local_zone ]]; then
+ die "error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"
+ fi
+ done
+ if [[ ! $sshable ]] || { ! $cron && [[ $sshfail ]]; }; then
+ die "failed to ssh to hosts: ${sshfail[*]}"
+ else
+ if [[ $sshfail ]]; then
+ ret=1
+ echo "$pre error: failed to ssh to ${sshfail[*]} but continuing with other hosts"
+ fi
+ targets=(${sshable[@]})
+ fi
+fi
+
+
+cat >/etc/btrbk.conf <<EOF
+ssh_identity /root/.ssh/home
+# Just a guess that local7 is a good facility to pick.
+# It's a bit odd that the transaction log has to be logged to
+# a file or syslog, while other output is sent to std out.
+# The man does not mention a way for them to be together, but
+# I dunno if setting a log level like warn might also output
+# transaction info.
+transaction_syslog local7
+
+# note, i had this because man said 20% speedup, but ran into
+# this issue, https://github.com/digint/btrbk/issues/275
+#stream_buffer 512m