Skip to content

Commit 51a6972

Browse files
author
Hugo Osvaldo Barrera
authored
Include a systemd.service file to run as a user (#800)
Include a systemd.service file to run as a user This new `systemd.service` file allows running and controlling the service as an unpriviledged user (generally, as part of a user session).
1 parent b0a94f9 commit 51a6972

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,6 @@ section = "sound"
9090
priority = "optional"
9191
assets = [
9292
["target/release/librespot", "usr/bin/", "755"],
93-
["contrib/librespot.service", "lib/systemd/system/", "644"]
93+
["contrib/librespot.service", "lib/systemd/system/", "644"],
94+
["contrib/librespot.user.service", "lib/systemd/user/", "644"]
9495
]

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ The above command will create a receiver named ```Librespot```, with bitrate set
8989
A full list of runtime options are available [here](https://github.com/librespot-org/librespot/wiki/Options)
9090

9191
_Please Note: When using the cache feature, an authentication blob is stored for your account in the cache directory. For security purposes, we recommend that you set directory permissions on the cache directory to `700`._
92+
9293
## Contact
9394
Come and hang out on gitter if you need help or want to offer some.
9495
https://gitter.im/librespot-org/spotify-connect-resources

contrib/librespot.service

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[Unit]
2-
Description=Librespot
2+
Description=Librespot (an open source Spotify client)
3+
Documentation=https://github.com/librespot-org/librespot
4+
Documentation=https://github.com/librespot-org/librespot/wiki/Options
35
Requires=network-online.target
46
After=network-online.target
57

@@ -8,8 +10,7 @@ User=nobody
810
Group=audio
911
Restart=always
1012
RestartSec=10
11-
ExecStart=/usr/bin/librespot -n "%p on %H"
13+
ExecStart=/usr/bin/librespot --name "%p@%H"
1214

1315
[Install]
1416
WantedBy=multi-user.target
15-

contrib/librespot.user.service

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Librespot (an open source Spotify client)
3+
Documentation=https://github.com/librespot-org/librespot
4+
Documentation=https://github.com/librespot-org/librespot/wiki/Options
5+
6+
[Service]
7+
Restart=always
8+
RestartSec=10
9+
ExecStart=/usr/bin/librespot --name "%u@%H"
10+
11+
[Install]
12+
WantedBy=default.target

0 commit comments

Comments
 (0)