我的机器正在运行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.
发布评论
评论(1)
您可能需要
参考,是将
body
变量插入命令中的代码。除非您的命令读取标准输入,否则您可以忽略
stdin_format
,该 nyy(You probably want
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).