我在Ubuntu 16.04 LTS中运行用户级服务.例如,我的test.service位于〜/ .config / systemd / user / test.service
我能够通过这样做来运行服务
systemctl --user start test.target
但是,当我尝试使用journalctl读取其日志时,我收到以下错误消息:
journalctl --user -u test.service Hint: You are currently not seeing messages from other users and the system. Users in the 'systemd-journal' group can see all messages. Pass -q to turn off this notice. No journal files were opened due to insufficient permissions.
如何将journalctl用于用户的特定单元?
在较旧的systemd版本中,您必须使用journalctl –user –user-unit = SERVICENAME(在较新的版本上,journalctl –user -u SERVICENAME将正常工作).
原文链接:https://www.f2er.com/ubuntu/348863.html但是,这仅在/etc/systemd/journald.conf的[Journal]部分的Storage指令设置为persistent(而不是auto或volatile)时才有效.编辑配置文件后重新启动,用户将能够看到日志.
更多信息:
https://www.freedesktop.org/software/systemd/man/journald.conf.html
https://lists.freedesktop.org/archives/systemd-devel/2016-October/037554.html