From: Ian Kelling Date: Thu, 4 Dec 2025 18:51:04 +0000 (-0500) Subject: fix prof-tail, still needs testing X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=c87e7cf3172c6313158eba4196bd88e6d43e1bcc;p=distro-setup fix prof-tail, still needs testing --- diff --git a/filesystem/usr/local/bin/prof-tail b/filesystem/usr/local/bin/prof-tail index 9a9c024..c84d77a 100755 --- a/filesystem/usr/local/bin/prof-tail +++ b/filesystem/usr/local/bin/prof-tail @@ -51,6 +51,7 @@ xmpp_users=( jtuttle ) + pre="^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{6}-[0-9]{2} -" while true; do @@ -58,6 +59,10 @@ while true; do secs_till_midnight=$(( midnight - EPOCHSECONDS )) log_today=$(date '+%Y_%m_%d').log logdir=/home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org + user_logs=() + for u in ${xmpp_users[@]}; do + user_logs+=($logdir/${u}_at_fsf.org/$log_today) + done # example room chat log: # @@ -66,7 +71,7 @@ while true; do # example pm chat log: # # 2025-11-02T16:29:27.100202-05 - me: ok. good luck -# 2025-11-02T17:42:02.547790-05 - zoe@fsf.org: oh damn + # 2025-11-02T17:42:02.547790-05 - zoe@fsf.org: oh damn # psuedocode simplified strategy: # tail room_logs | grep -v '^pre iank:' | grep iank | tail - pm_logs | grep -v "^$pre me:" @@ -74,7 +79,7 @@ while true; do timeout --foreground $secs_till_midnight tail -n0 -qF \ $logdir/rooms/*/$log_today 2>/dev/null \ | sed -rn "/$pre iank: /d;s/$pre /room: /;/\biank\b/p" \ - | tail -n0 -qF -- - $(for u in ${xmpp_users[@]}; do echo $logdir/${u}_at_fsf.org/$log_today; done) 2>/dev/null \ + | tail -n0 -qf --retry -- - ${user_logs[@]} \ | sed -rn "s/$pre ([^@:]+)@.*/pm: \1/p;/^room: /p" || [[ ${PIPESTATUS[0]} == 124 ]] # note: man timeout says 124 is when timeout times out.