Systemd/User Services/ru: Difference between revisions
Created page with "Systemd/Пользовательские сервисы" |
Created page with "<syntaxhighlight lang="nix"> systemd.user.services.my-cool-user-service = { enable = true; after = [ "network.target" ]; wantedBy = [ "default.target" ]; description = "Мой Классный Пользовательский Сервис"; serviceConfig = { Type = "simple"; ExecStart = ''/my/cool/user/service''; }; }; </syntaxhighlight>" |
||
| Line 11: | Line 11: | ||
Here is an example: | Here is an example: | ||
</div> | </div> | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
systemd.user.services.my-cool-user-service = { | systemd.user.services.my-cool-user-service = { | ||
| Line 17: | Line 16: | ||
after = [ "network.target" ]; | after = [ "network.target" ]; | ||
wantedBy = [ "default.target" ]; | wantedBy = [ "default.target" ]; | ||
description = " | description = "Мой Классный Пользовательский Сервис"; | ||
serviceConfig = { | serviceConfig = { | ||
Type = "simple"; | Type = "simple"; | ||
| Line 24: | Line 23: | ||
}; | }; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
By default, user services will be stopped when the user logs out and will start again when the user logs back in due to us setting {{ic|<nowiki>wantedBy = [ "default.target" ]</nowiki>}} in the example. | By default, user services will be stopped when the user logs out and will start again when the user logs back in due to us setting {{ic|<nowiki>wantedBy = [ "default.target" ]</nowiki>}} in the example. | ||