IRC 记录器通过电子邮件发送脚本且不需要数据库

发布于 2024-11-10 11:58:32 字数 95 浏览 9 评论 0原文

我正在寻找创建一个记录 IRC 频道的机器人,该频道只是间歇性地以电子邮件形式发送记录。并且不需要数据库。如果有什么东西可以完成这项工作,请提出建议。否则请让我知道如何构建它。

I am looking to create a bot that log 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

她说她爱他 2024-11-17 11:58:32

我不确定我是否见过提供所有这些功能的单一服务,但将各个部分组合在一起可能并不难。你运行什么样的系统?我会回答 Linux,因为我运行 IRC 服务器的机器上就是 Linux。

我在运行 IRCd 的物理设备上使用 irssi(从桌面通过 ssh 登录)。 irssi 中有一个设置可以在标记为离开时自动记录聊天。这样做可能更干净 使用机器人而不是始终登录的用户。无论哪种方式,您的日志都应该转储到文本文件。

接下来您需要一种发送电子邮件的方法。我认为对我来说最简单的方法是在记录 IRC 的同一台计算机上运行邮件服务器。这是一个令人惊讶的复杂过程,如果您的 ISP 正在过滤运行邮件服务器所需的端口,则可能会导致一些挫败感。或者,

一旦日志记录工具和邮件守护程序运行,您将需要一种方法来自动执行日常任务。您可以设置一个 cron 作业来 自动发送电子邮件。您可以尝试将文本文件作为附件发送,或者使用 cat 等工具将文件内容转储到电子邮件正文中。我建议在午夜执行 mv chat.log chat.txt 的 cron 作业,以便您的记录器在午夜以新的 chat.log 重新开始。每天晚上,您的 chat.txt 都会在午夜被前一天的日志覆盖。然后将其复制或附加到电子邮件中。

希望其中一些有帮助!我认为这实际上是一个很好的主意。我的 IRC 服务器不是很活跃,因此能够查看前一天的内容而不必通过 ssh 进入我的家庭服务器来查看日志可能会很好。

很抱歉没有包含更多链接。我还没有足够的声誉,但对搜索有帮助的是:
1. 设置postfix(或其他操作系统的SMTP服务器)
2. 如何设置 cron 作业来每天运行命令/脚本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文