summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar grawity@2ea26be48562f66fcb9b66307da72b1e2e37453f <grawity@web>2016-11-10 06:34:44 +0000
committerGravatar admin <admin@branchable.com>2016-11-10 06:34:44 +0000
commit9410477a1ef70bdaaab01125cc31c2b892012132 (patch)
tree09ad816d830395efee403024ef77ff49ed2efbf6
parentfb311c96405bb031a59b858640fd11516e96a2e7 (diff)
prefer per-user, fix ExecStart syntax
-rw-r--r--doc/tips/Systemd_unit.mdwn38
1 files changed, 19 insertions, 19 deletions
diff --git a/doc/tips/Systemd_unit.mdwn b/doc/tips/Systemd_unit.mdwn
index 4dd7d43af..f56e20dfe 100644
--- a/doc/tips/Systemd_unit.mdwn
+++ b/doc/tips/Systemd_unit.mdwn
@@ -16,59 +16,59 @@ It can be used as an alternative to XDG autostart files to start the git-annex d
##Setup
-### System service
+### User service
-Sample unit file (`/etc/systemd/system/git-annex@.service`):
+Sample unit file (`/etc/systemd/user/git-annex.service`):
```
[Unit]
Description=git-annex assistant daemon
-After=network.target
[Service]
-User=%i
-ExecStart=git-annex assistant --autostart --foreground
+ExecStart=/usr/bin/git-annex assistant --autostart --foreground
Restart=on-failure
[Install]
-WantedBy=multi-user.target
+WantedBy=default.target
```
-Commands for enabling and starting the service as user `u`:
+Commands for enabling and starting the service as the current user:
```
-systemctl enable git-annex@u.service
-systemctl start git-annex@u.service
-
+systemctl --user enable git-annex.service
+systemctl --user start git-annex.service
```
+Usually services in `default.target` start during login. (Note however that they also _delay_ the login process.) However, if you enable "linger" via `loginctl`, then these services start on boot instead.
-### User service
+### System service
-Sample unit file (`/etc/systemd/user/git-annex.service`):
+If for some reason you cannot use `systemd --user`, the other option is to have system-wide services:
+
+Sample unit file (`/etc/systemd/system/git-annex@.service`):
```
[Unit]
Description=git-annex assistant daemon
+After=network.target
[Service]
-ExecStart=git-annex assistant --autostart --foreground
+User=%i
+ExecStart=/usr/bin/git-annex assistant --autostart --foreground
Restart=on-failure
[Install]
-WantedBy=default.target
-
+WantedBy=multi-user.target
```
-Commands for enabling and starting the service as the current user:
+Commands for enabling and starting the service as user `u`:
```
-systemctl --user enable git-annex.service
-systemctl --user start git-annex.service
+systemctl enable git-annex@u.service
+systemctl start git-annex@u.service
```
-
---
## Considerations