fi
# -n or else it competes with the other ssh for reading stdin.
# -l iank is just a safety measure against misconfig/temporary config in .ssh/config.
- ssh -l iank -n $remote -- prof-tail -r | prof-notify &
+ ssh -l iank -n $remote -- prof-tail -r |& prof-notify &
ssh -l iank -t $remote tmux -L profanity a ||:
builtin kill %% &> /dev/null ||:
if (( EPOCHSECONDS > start + 600 )); then
# limitations under the License.
set -e; . /usr/local/lib/bash-bear; set +e
+# We infinite retry, not exit on error.
+trap err-info ERR
remote=false
if [[ $1 == -r ]]; then
shift
fi
+## flag to do manual testing during development
+dev=false
+tailn=0
+if [[ $1 == -e ]]; then
+ dev_date=(-d '-1 day')
+ tailn=100000
+ debug=true
+ dev=true
+ shift
+fi
-pkill -fA '^/bin/bash /usr/local/bin/prof-tail' ||:
-
+if ! $dev; then
+ pkill -fA '^/bin/bash /usr/local/bin/prof-tail' ||:
+fi
# kill 0 doesn't seem to be documented in man bash, but it kills the
# background processes.
# ruben
xmpp_users=(
+ jtuttle
andrew
craigt
dawnbp
ekokao
gregf
+ heshan
johnh
jrasata
ksiewicz
michael
+ sean
zoe
- jtuttle
)
tail-cmd() {
# note: man timeout says 124 is when timeout times out.
# for debugging, add test2 to the room list and use jtuttle with pidgin.
- timeout $secs_till_midnight tail -n0 -qF \
+ timeout $secs_till_midnight tail -n$tailn -qF \
$logdir/rooms/{sys-private,office,operations}_at_conference.fsf.org/$log_today ${user_logs[@]} 2>/dev/null \
| sed -urn "/$pre iank: /d;s/$pre ([^@ ]+: .*\biank\b.*)/\1/p;s/$pre ([^@:]+)@.*/pm: \1/p" || [[ ${PIPESTATUS[0]} == 124 ]]
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} -"
+declare -i fail_loops=0 loop_start
while true; do
+ loop_start=$EPOCH_SECONDS
midnight=$(date -d '00:00:00 tomorrow' +%s)
secs_till_midnight=$(( midnight - EPOCHSECONDS ))
- log_today=$(date '+%Y_%m_%d').log
+ log_today=$(date '+%Y_%m_%d' "${dev_date[@]}").log
logdir=/home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org
user_logs=()
for u in ${xmpp_users[@]}; do
tail-cmd | while :; do read -r l; notify-cmd "$l"; done
fi
+ if (( loop_start >= EPOCH_SECONDS - 1 )); then
+ fail_loops+=1
+ else
+ fail_loops=0
+ fi
+ if (( fail_loops >= 60 * 60 * 3 )); then
+ echo "prof-tail fail_loops: $fail_loops" >&2
+ exit 1
+ fi
+
sleep 2
done