various fixes and improvements
[distro-setup] / switch-mail-host
index 96e03ef494e911ed4fce3cfef7ef5589e45b0567..8d4072b72e1dc29b823a535db168f5a11c41b4d5 100755 (executable)
@@ -120,6 +120,22 @@ if $old_shell systemctl is-active btrbk.timer; then
     restore_old_btrbk=true
 fi
 
+for ((i=0; i<10; i++)); do
+    $old_shell killall arbtt-capture || break
+    sleep 1
+    if [[ i == 9 ]]; then
+        warn="WARNING!!! failed to kill arbtt-capture"
+    fi
+done
+for ((i=0; i<10; i++)); do
+    $new_shell killall arbtt-capture || break
+    sleep 1
+    if [[ i == 9 ]]; then
+        warn="WARNING!!! failed to kill arbtt-capture"
+    fi
+done
+
+
 $new_shell bash -s <<'EOF'
 set -eE
 if mountpoint /m; then sudo umount /m; fi
@@ -208,3 +224,7 @@ fi
 if $restore_old_btrbk; then
     $old_shell sudo systemctl start btrbk.timer
 fi
+
+$new_shell DISPLAY=:0 arbtt-capture --sample-rate=10 &
+
+echo $warn