dry_run=false # mostly for testing
rate_limit=no
verbose=true; verbose_arg=-v
+force=false
if [[ $INVOCATION_ID ]]; then
# INVOCATION_ID means running as a systemd service. we cant show progress in this case,
# but if we pass the arg, it will insert mbuffer into the command.
fast=false
kd_spread_maybe=false
orig_args=("$@")
-temp=$(getopt -l cron,fast,pull-reexec,help 23ceikl:m:npqrs:t:vh "$@") || usage 1
+temp=$(getopt -l cron,fast,pull-reexec,help 23cefikl:m:npqrs:t:vh "$@") || usage 1
eval set -- "$temp"
while true; do
case $1 in
-c) conf_only=true ;;
# quit early, just btrbk, no extra remounting etc.
-e) early=true ;;
+ -f) force=true ;;
# skip various checks. when we run twice in a row for
# switch mail-host, no need to repeat the same checks again.
--fast) fast=true ;;
kd_spread=false
+if ! $cron && $kd_spread_maybe; then
+ kd_spread=true
+fi
# set default targets
if [[ ! -v targets && ! $source ]]; then
if $cron; then
# which is good enough.
#
# This is a separate ssh because the command can fail and thatis ok.
- if $cron; then
+ if $cron && ! $force; then
locked=false
if lock_info=$(timeout -s 9 6 ssh $h DISPLAY=:0 xscreensaver-command -time); then
if [[ $lock_info != *non-blanked* ]]; then
if [[ $ret == 0 ]]; then
for tg in ${targets[@]}; do
- h=$(ssh root@$tg hostname)
- rsync -a /var/log/btrbk $tg:/var/log/btrbk/$tg
+ h=$(ssh $tg hostname)
+ rsync -a -f"- */" -f"+ *" /var/log/btrbk/ root@$tg:/var/log/btrbk/$tg
ssh root@$tg /usr/local/bin/mail-backup-clean
done
if [[ $source ]]; then
- rsync -a $source:/var/log/btrbk /var/log/btrbk/$source
+ rsync -a -f"- */" -f"+ *" $source:/var/log/btrbk/ /var/log/btrbk/$source
fi
fi