在SystemD中启动服务时如何添加用户输入
我有一个在SystemD
中配置的服务,该服务运行二进制文件并不断运行。问题在于,运行此二进制文件后,您必须通过在终端中键入y
来确认条款,并通过单击Enter
对其进行验证。我无法通过此文件运行此文件,因为Systemctl
状态在我看来是失败
,因为缺乏验证。有人知道我如何运行此服务并自动接受终端中的条款吗?
I have a service configured in systemd
that runs a binary file and it runs constantly. The problem is that after running this binary file, you have to confirm Terms&Conditions by typing y
in the terminal and validating it by click Enter
. I cannot run this file through this, because the systemctl
status appears to me as failed
, because of lack of validation. Does anyone know how I can run this service and automatically accept Terms in terminal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以这样的方式弄清楚了:
我在
usr/bin/bin
中创建了.sh
使用此内容:然后,我在
systemd
中创建了execstart:execstart:/path/path/ to/file.sh
现在起作用 -
Systemd
正在正确运行,日志记录,答案“是”仅在用户提示符出现时仅在二进制文件中输入一次。I figured it out in such a way:
I created
.sh
file inusr/bin
with this content:Then I created config file in
systemd
withExecStart: /path/to/file.sh
and now it works -
systemd
is running correctly, the logs are logging, the answer "yes" was typed only once in binary file when the user prompt appeared.我相信您也可以做类似的事情:
I believe you could also be able to do something like: