Systemd/User Services/zh: Difference between revisions

Ardenet (talk | contribs)
Created page with "== 用法 =="
Ardenet (talk | contribs)
Created page with "同样,您也可以为特定用户禁用某项服务:"
Tags: Mobile edit Mobile web edit
 
(5 intermediate revisions by the same user not shown)
Line 58: Line 58:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
同样,您也可以为特定用户禁用某项服务:
Likewise, you can also disable a service for a specific user:
</div>


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 71: Line 69:
== 用法 ==
== 用法 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
要与用户相关的 systemd 服务交互,请在 <code>systemctl</code> 命令中使用 <code>--user</code> 标志。例如,要检查用户服务的状态:
To interact with user-specific systemd services, use the <code>--user</code> flag with the <code>systemctl</code> command. For example, to check the status of a user service:
</div>


<syntaxhighlight lang="console"> $ systemctl --user status my-cool-user-service </syntaxhighlight>
<syntaxhighlight lang="console"> $ systemctl --user status my-cool-user-service </syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
要查看特定用户服务的日志,请使用 <code>journalctl</code> <code>--user-unit</code> 选项:
To view logs for a specific user service, use <code>journalctl</code> with the <code>--user-unit</code> option:
</div>


<syntaxhighlight lang="console"> $ journalctl --user-unit my-cool-user-service </syntaxhighlight>
<syntaxhighlight lang="console"> $ journalctl --user-unit my-cool-user-service </syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
列出所有活跃用户单位:
To list all active user units:
</div>


<syntaxhighlight lang="console"> $ systemctl --user list-units </syntaxhighlight>  
<syntaxhighlight lang="console"> $ systemctl --user list-units </syntaxhighlight>  


<div lang="en" dir="ltr" class="mw-content-ltr">
[[Category:systemd|分类:systmed]]
[[Category:systemd]]
</div>