在DNF自动通知时遇到麻烦

发布于 2025-02-05 05:44:15 字数 769 浏览 5 评论 0 原文

我的机器正在运行Rockylinux 8。我想通过电子邮件接收通知,但我相信如果正确的话,我必须自助SMTP服务器。

因此,我发现 gotify 是我手机的通知工具。我希望DNF自动化执行一个GoTify-CLI命令,哪种看起来像这样,因为“正文”是消息的主体:

gotify push "body"

这是dnf-automation的配置文件的一部分:

[emitters]
emit_via = command

[command]
# The shell command to execute. This is a Python format string, as used in
# str.format(). The format function will pass a shell-quoted argument called
# `body`.
command_format = "gotify push"

# The contents of stdin to pass to the command. It is a format string with the
# same arguments as `command_format`.
stdin_format = "{body}"

我是否正确设置了此功能?我在Python没有经验。而且有人知道如何更改机器运行DNF-automation的频率。

My machine is running Rockylinux 8. I would like to receive the notifications by email, but I believe that I have to self-host a SMTP server if that's correct.

So I find out Gotify as a notification tool for my phone. I want dnf-automatic to execute a gotify-cli command, which kind of looks like this, as "body" is the body of the message:

gotify push "body"

Here's part of the config file for dnf-automatic:

[emitters]
emit_via = command

[command]
# The shell command to execute. This is a Python format string, as used in
# str.format(). The format function will pass a shell-quoted argument called
# `body`.
command_format = "gotify push"

# The contents of stdin to pass to the command. It is a format string with the
# same arguments as `command_format`.
stdin_format = "{body}"

Am I setting this up correctly? I have no experience in Python. And does anyone knows how to change how often the machine runs dnf-automatic.timer, so I can troubleshoot.

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

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

发布评论

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

评论(1

一杆小烟枪 2025-02-12 05:44:15

您可能需要

[emitters]
emit_via = command

[command]
command_format = gotify push "{body}"

参考,是将 body 变量插入命令中的代码。

除非您的命令读取标准输入,否则您可以忽略 stdin_format ,该 nyy(

You probably want

[emitters]
emit_via = command

[command]
command_format = gotify push "{body}"

For reference, this is the code that interpolates the body variable into your command.

Unless your command reads the standard input you can ignore the stdin_format, which gets defaulted to {body} anyway (source).

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