一只乌龙,关于systemd的

当将一系列基于sh和golang的脚本从手工调用托管给systemd时,发现脚本不再正常工作,疑似systemd的StandardOutput=journey配置导致stdout被截取,影响程序运行。此问题引发对systemd配置理解和调试的讨论。
摘要由CSDN通过智能技术生成

今天一个同事告诉我遇到了一个问题:有一系列的sh和golang写的脚本,相互之间是通过stdout传递结果,在手工调用的时候工作良好,但是在托管给systemd的时候却不工作。怀疑是systemd截取了stdout,导致程序失败。

这个怀疑不无道理,因为在systemd的配置文件中有个很可以的配置项: StandardOutput=journey, 顺便贴出来官网对这个字段的解释:

StandardOutput=

Controls where file descriptor 1 (STDOUT) of the executed processes is connected to. Takes one of inherit, null, tty, journal, syslog, kmsg, journal+console, syslog+console, kmsg+console, file:path, socket or fd:name.

inherit duplicates the file descriptor of standard input for standard output.

null connects standard output to /dev/null, i.e. everything written to it will be lost.

tty connects standard output to a tty (as configured via TTYPath=, see below). If the TTY is used for output only, the executed process will not become the controlling process of the terminal, and will not fail or wait for other processes to release the terminal.

journal connects standard output with the journal which is accessible via

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值