我在我的覆盆子皮上有一个有趣的发现。如果我以根用户身份运行以下命令:

htop > /dev/tty0

然后htop的输出将直接打印在屏幕上(hdmi连接)
我想运行htop作为服务,但当我在systemd脚本中运行时,它会说
systemd error opening terminal unknown

怎么解决?
我也试过了
cat /dev/null | htop > /dev/tty

同样的结果。。。

最佳答案


[Service]
StandardOutput=tty

.service文件中。详见systemd.exec(5)

关于linux - 如何直接在tty上运行诸如htop之类的交互式控制台程序?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49224893/

10-15 14:34