added logging

This commit is contained in:
Dimitar Dimitrov 2013-07-22 18:29:05 +01:00
parent 9ac2cf758c
commit 6fa615ca02
2 changed files with 4 additions and 1 deletions

View File

@ -2,3 +2,4 @@ server="irc.freenode.net"
channel="linux"
nick="bashbot"
user="username hostname servername :realname"
log="log.txt"

4
bot.sh
View File

@ -2,12 +2,15 @@
. bot.properties
input=".bot.cfg"
echo "Starting session: $(date "+[%y:%m:%d %T]")">$log
echo "NICK $nick" > $input
echo "USER $user" >> $input
echo "JOIN #$channel" >> $input
tail -f $input | telnet $server 6667 | while read res
do
# log the session
echo "$(date "+[%y:%m:%d %T]")$res" >> $log
# do things when you see output
case "$res" in
# respond to ping requests from the server
@ -42,7 +45,6 @@ do
fi
will=$(echo "$will" | perl -pe "s/^ //")
com=$(echo "$will" | cut -d " " -f1)
echo "COM:$com"
if [ -z "$(ls modules/ | grep -i -- "$com.sh")" ]
then
./modules/help.sh $who $from >> $input