diff --git a/irc-bot b/irc-bot index b000a34..42a3f3f 100755 --- a/irc-bot +++ b/irc-bot @@ -2,14 +2,16 @@ # Super simple IRC bot. -NICK="bitlair-space" -CHANNEL="#bitlair-test" +NICK="bitlair" +CHANNEL="#bitlair" SERVER="irc.smurfnet.ch" INPORT="31337" set -eu set -o pipefail +trap 'kill $(jobs -p)' INT TERM EXIT + loop="/tmp/irc-bot-loop" mkfifo "$loop" trap "rm -f $loop" INT TERM EXIT @@ -25,7 +27,7 @@ echo "JOIN $CHANNEL" tail -f "$loop" & while true; do - echo "NOTICE $CHANNEL $(nc -lp "$INPORT" | tr '\n' ' ')" + echo "NOTICE $CHANNEL $(nc -lp "$INPORT" | tr -c -d '[:print:]')" done } | \ nc "$SERVER" 6667 | while read message; do diff --git a/start.sh b/start.sh index a40a5c8..a9a8084 100755 --- a/start.sh +++ b/start.sh @@ -1,3 +1,7 @@ #!/bin/bash -su -s /bin/bash - nobody -c "$(dirname $0)/irc-bot" +while true +do + su -s /bin/bash - nobody -c "$(dirname $0)/irc-bot" + sleep 10 +done