Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squeezelite User Service for Systemd #166

Open
snakeroot opened this issue Sep 12, 2022 · 1 comment
Open

Squeezelite User Service for Systemd #166

snakeroot opened this issue Sep 12, 2022 · 1 comment

Comments

@snakeroot
Copy link

This is similar to #163 but for systemd. The current systemd service runs as a "system" as versus a "user" service, which then doesn't work with pipewire as a service in pulseaudio emulation mode (and, I suspect, pulseaudio as well, although I haven't checked). If one starts squeezelite as a user service everything is fine.

I created the following systemd service file and placed it in /etc/systemd/user as "squeezelite.service:

[Unit]
Description=Squeezelite Player for %u

[Service]
EnvironmentFile=-/etc/squeezelite.conf
EnvironmentFile=-%h/.config/squeezelite/squeezelite.conf

ExecStart=/usr/bin/squeezelite
$OPTIONS
$NAME $MAC $PRIORITY
$MAX_RATE $AUDIO_DEV
$BUFFER $CODEC $ALSA_PARAMS $VOLUME
$LOG_FILE $LOG_LEVEL
$UPSAMPLE $DOP $VISULIZER $SERVER_IP

As you can see, it's an adaptation of the current system service file, except that:
--cgroup controls are removed since absent a delegation users don't have control over the relevant resources
--the EnvironmentFile allows for over-ride of the system defaults on a per-user basis by allowing users to create an over-ride file in ~/.config/squeezelite

I used this to tweak the default squeezelite.conf so that the log would be written in the users home directory and the player name would be user specific and would use pipewire.

@mavit
Copy link

mavit commented Dec 21, 2022

FWIW, the Fedora package for squeezelite also includes systemd services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants