forked from gboudreau/Greyhole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
irc_notif.sh
executable file
·35 lines (31 loc) · 998 Bytes
/
irc_notif.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Originally: shellbot.sh - IRC Bot, Author: Sean B. Palmer, inamidst.com
# Adapted for Greyhole notifications by Guillaume Boudreau, pommepause.com
NICK=GHNotifier
SERVER=irc.freenode.net
PORT=6667
CHANNEL=#greyhole
PASSWORD=`cat .irc_password`
MSG=$1
cat > /tmp/shellbot.input <<EOF
NICK $NICK
USER gboudreau +Zi $NICK :$0
PRIVMSG NickServ :IDENTIFY $PASSWORD
JOIN $CHANNEL
PRIVMSG $CHANNEL :$MSG
EOF
tail -n 10 -f /tmp/shellbot.input | telnet $SERVER $PORT | \
while true
do read LINE || break
echo "`date +"%Y-%m-%d %H:%M:%S"` $LINE"
if echo $LINE | grep -i "MODE $CHANNEL +o $NICK" &> /dev/null
then
echo "TOPIC $CHANNEL :Greyhole - Storage Pooling on Samba - Latest version: $VERSION - Homepage: http://greyhole.net - Support: http://support.greyhole.net - Twitter: @greyholeapp" >> /tmp/shellbot.input
sleep 1
echo "QUIT" >> /tmp/shellbot.input
sleep 1
killall telnet
killall tail
fi
done
rm /tmp/shellbot.input