s tar $attributes --numeric-owner --one-file-system -C r -cf - . | zstd -9 > /b/fai-basefiles/ECNE64.tar.zst
echo "WARNING: remove leftover /t/mmchroot"
}
+
+# cleans up bind mounts that got leftover by an schroot. dunno yet why
+# this happens. Based on
+# http://logan.tw/posts/2018/02/24/manage-chroot-environments-with-schroot/#list-all-schroot-sessions
+
+schroot-cleanup() {
+ local session sessions
+ sessions=$(schroot -l --all-sessions | sed 's/session://')
+ for session in $sessions; do
+ schroot -e -c $session
+ done
+}
+
+
+massix-ping() {
+ ips=(206.53.143.47 206.53.143.5 206.53.143.46 206.53.143.21 206.53.143.69 206.53.143.10 206.53.143.23 206.53.143.79 206.53.143.36 206.53.143.48 206.53.143.78 206.53.143.4 206.53.143.29 206.53.143.7 206.53.143.25 206.53.143.38 206.53.143.34 206.53.143.80 206.53.143.19 206.53.143.18 206.53.143.22 206.53.143.63 206.53.143.9 206.53.143.31 206.53.143.28 206.53.143.24 206.53.143.58 206.53.143.6 206.53.143.52 206.53.143.53 206.53.143.8 206.53.143.39 206.53.143.72 206.53.143.54 206.53.143.75 206.53.143.2 206.53.143.15 206.53.143.50 206.53.143.17 206.53.143.16 206.53.143.68 206.53.143.61 206.53.143.42 206.53.143.81 206.53.143.252 206.53.143.253 206.53.143.55 206.53.143.73 206.53.143.30 206.53.143.14 206.53.143.26 206.53.143.40 206.53.143.35 206.53.143.1 206.53.143.20 206.53.143.11 206.53.143.67 206.53.143.3 206.53.143.41 206.53.143.56 206.53.143.62 206.53.143.32 206.53.143.84 206.53.143.37 206.53.143.70 206.53.143.60 206.53.143.88 206.53.143.49 206.53.143.43 206.53.143.74 206.53.143.13 206.53.143.51 206.53.143.44 206.53.143.33 206.53.143.87 206.53.143.77 206.53.143.76 206.53.143.65 206.53.143.12 206.53.143.27 206.53.143.57 206.53.143.71)
+
+ while true; do for i in 0 10 20 30 40 50 60 70; do fping -c 1 ${ips[@]:$i:10}; sleep 10 || break; done; done
+ }
vol=${dir##*/}
root_dir=${dir%/*}
if [[ ! -d $root_dir ]]; then
- # this only exists on host kd currently
+ # this only exists on one host.
continue
fi
# if latest is already mounted, make sure binds are mounted and move on
continue
fi
if [[ -d $dir ]]; then
+ kill_dirs=($dir)
if ! kill-dir TERM TERM TERM INT INT HUP HUP TERM TERM TERM INT INT HUP HUP; then
if $force; then kill-dir KILL; fi
fi
dir_regex="$dir_regex|${kill_dirs[$i]}"
fi
done
- pids=$(timeout 30 lsof -XF n | awk 'BEGIN { RS = "\np" }; {if($1 in printed_pids) next; for(i=2;i<=NF;i++){ if($i ~ "^n('$dir_regex')(/|$)") { printed_pids[$1]=1; printf("%s ", $1); break} } }')
+ pids=$(timeout 15 lsof -XF n | awk 'BEGIN { RS = "\np" }; {if($1 in printed_pids) next; for(i=2;i<=NF;i++){ if($i ~ "^n('$dir_regex')(/|$)") { printed_pids[$1]=1; printf("%s ", $1); break} } }')
+}
+
+get-pids-debug() {
+ kill_dirs=("$@")
+ get-pids
+ echo "pids: $pids"
+ first_pid=true
+ for pid in $pids; do
+ if $first_pid; then
+ ps_pids=$pid
+ first_pid=false
+ else
+ ps_pids+=,$pid
+ fi
+ done
+ e ps -f -p $ps_pids
+ ps -f -p $ps_pids
}
kill-dir() {
# ran out of signals to try:
if (( i == $# )); then
return 1
+ elif (( i >= 1 )); then
+ sleep .5
fi
sig=${sigs[$i]}
pid-check
ps_pids+=,$pid
fi
done
- pd -f -p $ps_pids
+ ps -f -p $ps_pids
kill -$sig $pids
done
}