Systemd/User Services/zh: Difference between revisions
Created page with "== 注销后保持用户服务运行 ==" |
Created page with "同样,您也可以为特定用户禁用某项服务:" Tags: Mobile edit Mobile web edit |
||
| (6 intermediate revisions by the same user not shown) | |||
| Line 45: | Line 45: | ||
</div> | </div> | ||
< | <span id="Enabling_a_service_for_specific_users"></span> | ||
== | == 为特定用户启用服务 == | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 59: | Line 58: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
同样,您也可以为特定用户禁用某项服务: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 69: | Line 66: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
< | <span id="Usage"></span> | ||
== | == 用法 == | ||
要与用户相关的 systemd 服务交互,请在 <code>systemctl</code> 命令中使用 <code>--user</code> 标志。例如,要检查用户服务的状态: | |||
<syntaxhighlight lang="console"> $ systemctl --user status my-cool-user-service </syntaxhighlight> | <syntaxhighlight lang="console"> $ systemctl --user status my-cool-user-service </syntaxhighlight> | ||
要查看特定用户服务的日志,请使用 <code>journalctl</code> 和 <code>--user-unit</code> 选项: | |||
<syntaxhighlight lang="console"> $ journalctl --user-unit my-cool-user-service </syntaxhighlight> | <syntaxhighlight lang="console"> $ journalctl --user-unit my-cool-user-service </syntaxhighlight> | ||
列出所有活跃用户单位: | |||
<syntaxhighlight lang="console"> $ systemctl --user list-units </syntaxhighlight> | <syntaxhighlight lang="console"> $ systemctl --user list-units </syntaxhighlight> | ||
[[Category:systemd|分类:systmed]] | |||
[[Category:systemd]] | |||