}
_jrun() { # journal run. run args, log to journal, tail and grep the journal.
+ # Redirect all commands which might have stderr to stdout because of
+ # wrapping.
local pid pattern jr_pid sedscript cmd_name ended
ret=0
case $1 in
-p)
- pattern="$2\|"
+ pattern="$2|"
shift 2
;;
esac
cmd_name=${1##*/}
systemd-cat -t "$cmd_name" "$@" 2>&1 &
pid=$!
- sedscript="/$pattern$cmd_name/p;/^.{16}[^ ]+ $cmd_name\[$pid]: ([^ ]+ +)?exiting with status [0-9]+\$/q"
+ sedscript="/$pattern$cmd_name/p;/^.{16}[^ ]+ $cmd_name\[$pid]: $cmd_name: exiting with status [0-9]+\$/q"
journalctl -S "4 seconds ago" -f |& sed -nr "$sedscript" 2>&1 &
jr_pid=$!
wait $pid 2>&1 || ret=$?
done < "$file"
}
+failfunc() { asdf a b c; }
+failfunc2() { failfunc d e f; }
# one that comes with distros is too old for newer devices
fastboot() {
#hr; echo dnsmasq is $(systemctl is-active dnsmasq)
f=/var/run/dnsmasq/resolv.conf
hr; echo $f:; ccat $f
- hr; m grr '^ *servers-file *=' /etc/dnsmasq.conf /etc/dnsmasq.d
+ hr; m grr '^ *(servers-file|server) *=|^ *no-resolv *$' /etc/dnsmasq.conf /etc/dnsmasq.d
f=/etc/dnsmasq-servers.conf
hr; echo $f:; ccat $f
}