tl-stream/obs-chat/obs-chat-monitor.bash

26 lines
519 B
Bash
Executable File

#!/usr/bin/env bash
# Move pwd to the same dir where the script is located
scriptpath=$(dirname "$0")
cd "$scriptpath" || exit
# Source untracked variables
source ./obs-chat-monitor.conf
# Remaining operational vars
sedscript="./weechat-massage.sed"
foldwidth=50
maxlines=15
outfile="/tmp/obs-chat.txt"
# Clear $outfile
printf '%.0s\n' $(seq $maxlines) > "$outfile"
ssh "$remotehost" \
tail -fn0 "$remotelog" | \
sed -u -r -f "$sedscript" | \
stdbuf -i0 -o0 \
fold -s -w "$foldwidth" | \
tee -a "$outfile"