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).
This commit is contained in:
Hugo Osvaldo Barrera 2021-06-18 11:40:44 +02:00 committed by GitHub
parent b0a94f901d
commit 51a697201b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View file

@ -90,5 +90,6 @@ section = "sound"
priority = "optional" priority = "optional"
assets = [ assets = [
["target/release/librespot", "usr/bin/", "755"], ["target/release/librespot", "usr/bin/", "755"],
["contrib/librespot.service", "lib/systemd/system/", "644"] ["contrib/librespot.service", "lib/systemd/system/", "644"],
["contrib/librespot.user.service", "lib/systemd/user/", "644"]
] ]

View file

@ -89,6 +89,7 @@ The above command will create a receiver named ```Librespot```, with bitrate set
A full list of runtime options are available [here](https://github.com/librespot-org/librespot/wiki/Options) A full list of runtime options are available [here](https://github.com/librespot-org/librespot/wiki/Options)
_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`._ _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`._
## Contact ## Contact
Come and hang out on gitter if you need help or want to offer some. Come and hang out on gitter if you need help or want to offer some.
https://gitter.im/librespot-org/spotify-connect-resources https://gitter.im/librespot-org/spotify-connect-resources

View file

@ -1,5 +1,7 @@
[Unit] [Unit]
Description=Librespot Description=Librespot (an open source Spotify client)
Documentation=https://github.com/librespot-org/librespot
Documentation=https://github.com/librespot-org/librespot/wiki/Options
Requires=network-online.target Requires=network-online.target
After=network-online.target After=network-online.target
@ -8,8 +10,7 @@ User=nobody
Group=audio Group=audio
Restart=always Restart=always
RestartSec=10 RestartSec=10
ExecStart=/usr/bin/librespot -n "%p on %H" ExecStart=/usr/bin/librespot --name "%p@%H"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -0,0 +1,12 @@
[Unit]
Description=Librespot (an open source Spotify client)
Documentation=https://github.com/librespot-org/librespot
Documentation=https://github.com/librespot-org/librespot/wiki/Options
[Service]
Restart=always
RestartSec=10
ExecStart=/usr/bin/librespot --name "%u@%H"
[Install]
WantedBy=default.target