prefer per-user, fix ExecStart syntax
This commit is contained in:
parent
ed742953f2
commit
30e07dbd9b
1 changed files with 28 additions and 28 deletions
|
@ -16,8 +16,35 @@ It can be used as an alternative to XDG autostart files to start the git-annex d
|
|||
|
||||
##Setup
|
||||
|
||||
### User service
|
||||
|
||||
Sample unit file (`/etc/systemd/user/git-annex.service`):
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=git-annex assistant daemon
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/git-annex assistant --autostart --foreground
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
Commands for enabling and starting the service as the current user:
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
### System 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`):
|
||||
|
||||
```
|
||||
|
@ -27,7 +54,7 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
User=%i
|
||||
ExecStart=git-annex assistant --autostart --foreground
|
||||
ExecStart=/usr/bin/git-annex assistant --autostart --foreground
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
@ -42,33 +69,6 @@ systemctl start git-annex@u.service
|
|||
|
||||
```
|
||||
|
||||
|
||||
### User service
|
||||
|
||||
Sample unit file (`/etc/systemd/user/git-annex.service`):
|
||||
|
||||
```
|
||||
[Unit]
|
||||
Description=git-annex assistant daemon
|
||||
|
||||
[Service]
|
||||
ExecStart=git-annex assistant --autostart --foreground
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
```
|
||||
|
||||
Commands for enabling and starting the service as the current user:
|
||||
|
||||
```
|
||||
systemctl --user enable git-annex.service
|
||||
systemctl --user start git-annex.service
|
||||
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Considerations
|
||||
|
|
Loading…
Reference in a new issue