IRC Logger that Emails Transcripts and requires no database
I am looking to create a bot that log开发者_如何学Python an IRC channel that simply sends the transcripts as an email intermittently. And requires no DB. If there's something out there which does this job please suggest. Otherwise let me know how this could be built.
I'm not sure I've seen a single service that offered all of that, but it might not be too hard to put together in parts. What kind of system are you running? I'll answer for Linux, since that's what I have on the machine that's running my IRC server.
I use irssi (logged in via ssh from my desktop) on the physical device running the IRCd. There's a setting in irssi to automatically log the chat while flagged as away. It's probably cleaner to do this with a bot rather than having an always-logged-in user. Either way, your log should dump to a text file.
Next you'll need a way to send emails. I think the easiest way for me would be to run a mail server on the same computer that's logging IRC. This is a surprisingly involved process and may cause some frustration if your ISP is filtering ports needed to run a mail server. Alternately
Once a logging tool and mail daemon are running, you would need a way to automate your daily task. You could set up a cron job to automate the sending of an email. You could experiment with sending your text file as an attachment or instead having the contents of the file dumped into the body of an email using a tool like cat
. I would recommend a cron job at midnight that does mv chat.log chat.txt
so that your logger gets to start over with a fresh chat.log
at midnight. Each night, your chat.txt
will be overwritten at midnight by the previous day's log. Then copy or attach it to an email.
Hopefully some of that is helpful! It's actually a pretty good idea, I think. My IRC server is not very active, so it might be nice to be able to look at the previous day's content without having to ssh into my home server to look at the logs.
Apologies for not including more links. I don't have enough reputation yet, but helpful to search will be: 1. Setting up postfix (or SMTP server for other OS) 2. How to set up a cron job to run a command/script daily.
精彩评论