mostly improvements, wip
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 6ac51839640d6b111de332c2196a89468ff154f4..7699add59555e0dcb824686d4ee2835c12dd0867 100644 (file)
--- a/brc2
+++ b/brc2
@@ -1682,11 +1682,9 @@ jdo() {
   if [[ $cmd != /* ]]; then
     cmd=$(type -P "$cmd")
   fi
+  #note date format for since is date '+%F %T'
   # -q = quiet
-  journalctl -qn2 -f -u "$cmd_name" &
-  # Trial and error of time needed to avoid missing initial lines.
-  # .5 was not reliable. 1 was not reliable. 2 was not reliable
-  sleep 4
+  journalctl --since=now -qn2 -f -u "$cmd_name" &
   jr_pid=$!
   # note, we could have a version that does system --user, but if for example
   # it does sudo ssh, that will leave a process around that we can't kill
@@ -4177,10 +4175,7 @@ vpn() {
   fi
 
   [[ $1 ]] || { echo need arg; return 1; }
-  journalctl --unit=$vpn_service@$1 -f -n0 &
-  # sometimes the journal doesnt open until after the vpn output
-  # has happened. hoping this fixes that.
-  sleep 1
+  journalctl --since=now --unit=$vpn_service@$1 -f -n0 &
   sudo systemctl start $vpn_service@$1
   # sometimes the ask-password agent does not work and needs a delay.
   sleep .5
@@ -4199,15 +4194,17 @@ fixu() {
   fi
 }
 
-# unmute
+# unmute desktop output
 um() {
-  local sink card
+  local sink card sedcmd
   sink=$(pactl get-default-sink)
   if [[ $sink == auto_null ]]; then
     # guessing there is just one with an off profile. otherwise we will
     # need some other solution, like storing the card identifier that we
-    # muted with nap.
-    card=$(pacmd list-cards | sed -n '/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: <off>$/{g;p;q}')
+    # muted with nap. Or, we could so some hakery with
+    # pactl -f json.
+    sedcmd='/^[[:space:]]*index:/{s/^[[:space:]]*index://;h};/^[[:space:]]*active profile: <off>$/{g;p;q}'
+    card=$(pacmd list-cards | sed -n "$sedcmd")
     m pacmd set-card-profile "$card" output:analog-stereo
   fi
 
@@ -4725,7 +4722,8 @@ ftoc() {
   units "tempF($1)" tempC
 }
 
-# requires dns/firewall setup first
+# note: requires dns setup of live.iankelling.org, & if i'm home, port
+# forwarding in wrt-setup-local.  todo: automate that.
 local-icecast() {
   web-conf -e ian@iankelling.org -f 8000 - apache2 live.iankelling.org  <<'EOF'
 <Location "/fsf.webm">
@@ -4778,17 +4776,24 @@ opensslcertinfo() {
 
 # dsh on btrbk hosts
 dsb() {
-:
-  }
+  :
+}
 
 # dsh a file and run it
 dsa() {
   local ret file
   if ! parallel -j 10 scp x {}:/tmp <~/.dsh/group/btrbk; then
     echo parallel scp failed. dsa returning $ret
-    fi
+  fi
   dsh -g btrbk
-  }
+}
+
+# temporary
+zmqsend() {
+  /nocow/t/ffmpeg-release/ffmpeg-7.0.1/tools/zmqsend "$@"
+}
+
+ffg() { /nocow/t/ffmpeg-release/ffmpeg-7.0.1/tools/graph2dot -o /tmp/g.tmp && dot -Tpng /tmp/g.tmp -o /tmp/g.png && feh /tmp/g.png; }
 
 export BASEFILE_DIR=/a/bin/fai-basefiles