X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=btrbk-run;h=057ff79b6ed052617209726ef39c293a3743bccc;hb=46bcc5c1876aed04c2a4111a6ddd887951238ed6;hp=5388858b946c44640ed18fa25285acfbdcb296ac;hpb=dc34d23c63cd83a7cc7a79525445aad3293c7241;p=distro-setup diff --git a/btrbk-run b/btrbk-run index 5388858..057ff79 100644 --- a/btrbk-run +++ b/btrbk-run @@ -65,6 +65,7 @@ conf_only=false 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. @@ -91,7 +92,7 @@ cron=false 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 @@ -110,6 +111,7 @@ while true; do -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 ;; @@ -214,6 +216,9 @@ fi kd_spread=false +if ! $cron && $kd_spread_maybe; then + kd_spread=true +fi # set default targets if [[ ! -v targets && ! $source ]]; then if $cron; then @@ -517,7 +522,7 @@ else # 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 @@ -718,12 +723,12 @@ fi 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