Systemd/User Services: Difference between revisions
repositon translate tag Tags: Mobile edit Mobile web edit Visual edit |
Marked this version for translation Tags: Mobile edit Mobile web edit |
||
| Line 40: | Line 40: | ||
You'll also likely want to change to {{ic|<nowiki>wantedBy = [ "multi-user.target" ];</nowiki>}} so the service starts at boot time. | You'll also likely want to change to {{ic|<nowiki>wantedBy = [ "multi-user.target" ];</nowiki>}} so the service starts at boot time. | ||
== Enabling a service for specific users == | == Enabling a service for specific users == <!--T:10--> | ||
<!--T:11--> | |||
By default, enabling a user service enables it for every user for which systemd spawns a service manager. If you wish for the service to be run only for specific users (say, {{ic|<nowiki>UserA</nowiki>}} and {{ic|<nowiki>UserB</nowiki>}}), use {{ic|<nowiki>ConditionUser</nowiki>}} ({{ic|<nowiki>man 5 systemd.unit</nowiki>}}): | By default, enabling a user service enables it for every user for which systemd spawns a service manager. If you wish for the service to be run only for specific users (say, {{ic|<nowiki>UserA</nowiki>}} and {{ic|<nowiki>UserB</nowiki>}}), use {{ic|<nowiki>ConditionUser</nowiki>}} ({{ic|<nowiki>man 5 systemd.unit</nowiki>}}): | ||
</translate> | </translate> | ||
| Line 52: | Line 53: | ||
<translate> | <translate> | ||
<!--T:12--> | |||
Likewise, you can also disable a service for a specific user: | Likewise, you can also disable a service for a specific user: | ||
</translate> | </translate> | ||
| Line 62: | Line 64: | ||
<translate> | <translate> | ||
== Usage == | == Usage == <!--T:13--> | ||
<!--T:14--> | |||
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: | 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: | ||
</translate> | </translate> | ||
| Line 70: | Line 73: | ||
<translate> | <translate> | ||
<!--T:15--> | |||
To view logs for a specific user service, use <code>journalctl</code> with the <code>--user-unit</code> option: | To view logs for a specific user service, use <code>journalctl</code> with the <code>--user-unit</code> option: | ||
</translate> | </translate> | ||
| Line 76: | Line 80: | ||
<translate> | <translate> | ||
<!--T:16--> | |||
To list all active user units: | To list all active user units: | ||
</translate> | </translate> | ||
| Line 82: | Line 87: | ||
<translate> | <translate> | ||
<!--T:17--> | |||
[[Category:systemd]] | [[Category:systemd]] | ||
</translate> | </translate> | ||