#!/usr/bin/env ash . /home/zgrep/offtopiabday/happybot/common.sh chanlist="${chanlist:-}" pwfile="${pwfile:-}" if [ -z "$chanlist" ]; then echo "Need channel list." exit 1 fi # - Read logs. # - Print when we get message 376. tail -n 0 -f "$serv/out" | while read -r l; do if [ -z "$(var "$l" | sed -n '/^\S\S* \S\S* \[376\]/p')" ]; then continue fi if ! [ -z "$pwfile" ]; then cat "$pwfile" > '/home/zgrep/offtopiabday/'"$serv"'/in' sleep 0.5 fi echo '/JOIN '"$chanlist" > '/home/zgrep/offtopiabday/'"$serv"'/in' done