btrbk filxes
authorIan Kelling <iank@fsf.org>
Tue, 11 Jun 2019 01:08:48 +0000 (21:08 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 11 Jun 2019 01:08:48 +0000 (21:08 -0400)
Make install-my-scripts run separately else it will cause errors if
installing changed version while running.

btrbk-run
machine_specific/btrbk/filesystem/etc/systemd/system/btrbk.service
mount-latest-subvol
switch-mail-host

index 187a29a86bcab7a1e1218e94adfea65c664eeddc..a5fd62a45c54bbbd592d570654c2ceca13fa3c9c 100644 (file)
--- 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"
index d1c1657ff9c3476aa05b5f40b636bc482424b3d9..299ecff51e2b85db8f3e066c1c3623deccef42e8 100644 (file)
@@ -4,4 +4,6 @@ After=multi-user.target
 
 [Service]
 Type=oneshot
+ExecStart=/usr/local/bin/install-my-scripts
 ExecStart=/a/bin/log-quiet/sysd-mail-once btrbk /usr/local/bin/btrbk-run -q --cron
+ExecStart=/usr/local/bin/install-my-scripts
index cfcbd727ad226893333fae699ac6e400476735ed..ea1d1f89195cc26420e68aa462671d1288eef5c4 100644 (file)
@@ -372,10 +372,6 @@ for vol in q a o i; do
   stale_dir=/nocow/btrfs-stale
   rm -f $stale_dir/$d
 
-  if [[ $vol == a ]]; then
-    # useful to keep this at the latest version
-    /a/exe/install-my-scripts
-  fi
 done
 
 ### disabled
index 13209a2164e4eec951dcc9dc6a76e7a3be07b299..cbb7e69e3d421bbd7af7c26e5a8314a0ff3eeb29 100644 (file)
@@ -142,8 +142,6 @@ EOF
 
 $old_shell primary-setup $new_hostname
 
-/a/bin/distro-setup/install-my-scripts
-
 if $localhost_new; then
   btrbk-run -s $old_host $mp_args
 else