X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=btrbk-run;h=a5fd62a45c54bbbd592d570654c2ceca13fa3c9c;hp=187a29a86bcab7a1e1218e94adfea65c664eeddc;hb=3c86472e219aaf3c97b1f878b4a818644b282aba;hpb=1f524e72136f1d10548bdc4f502c6405ba6dbcd0 diff --git a/btrbk-run b/btrbk-run index 187a29a..a5fd62a 100644 --- a/btrbk-run +++ b/btrbk-run @@ -255,8 +255,16 @@ else sshable=() sshfail=() + min_idle=$((60 * 15)) for h in ${targets[@]}; do if zone=$(ssh root@$h "mkdir -p /mnt/root/btrbk && date +%z"); then + if $cron && xidle=$(ssh iank@$h DISPLAY=:0 xprintidle) && [[ $xidle && $xidle -lt $min_idle ]]; then + # This is a separate ssh because xprintidle can fail and thats ok. + # Ignore this host. i sometimes use a non-main machine for testing or web browsing, knowing that + # everything will be wiped by the next backup, but I dont want it to happen as Im using + # it from cronjob. + continue + fi sshable+=($h) if [[ $zone != $local_zone ]]; then die "error: dont confuse yourself with multiple time zones. $h has different timezone than localhost"