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

unable to have the scream service working on startup #155

Closed
Thomson-Skelington opened this issue Sep 20, 2021 · 3 comments
Closed

unable to have the scream service working on startup #155

Thomson-Skelington opened this issue Sep 20, 2021 · 3 comments

Comments

@Thomson-Skelington
Copy link

Hi,
I'm using scream on a raspberry pi running raspbian
I setup a systemctl service for scream in /etc/systemd/system/scream.service

[Unit]
Description=Scream Receiver
After=pulseaudio.service network-online.target
Wants=pulseaudio.service
#Requires=pulseaudio.service

[Service]
User=pi
Type=simple
ExecStart=/home/pi/scream/Receivers/unix/build/scream -u -p 4011 -v

[Install]
WantedBy=default.target

While logged in ssh if I do sudo systemctl start scream it works fine
But with sudo systemctl enable scream it fails to start on boot.
systemctl status scream shows this

● scream.service - Scream Receiver
   Loaded: loaded (/etc/systemd/system/scream.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-09-20 13:59:06 BST; 41s ago
  Process: 300 ExecStart=/home/pi/scream/Receivers/unix/build/scream -u -p 4011 -v (code=exited, status=1/FAILURE)
 Main PID: 300 (code=exited, status=1/FAILURE)

Sep 20 13:59:04 raspberrypi systemd[1]: Started Scream Receiver.
Sep 20 13:59:05 raspberrypi scream[300]: Using Pulseaudio output
Sep 20 13:59:05 raspberrypi scream[300]: Unable to connect to PulseAudio. Connection refused
Sep 20 13:59:06 raspberrypi systemd[1]: scream.service: Main process exited, code=exited, status=1/FAILURE
Sep 20 13:59:06 raspberrypi systemd[1]: scream.service: Failed with result 'exit-code'.
@Thomson-Skelington Thomson-Skelington changed the title unable tu have the scream service working on startup unable to have the scream service working on startup Sep 20, 2021
@duncanthrax
Copy link
Owner

Could be a race condition. Pulseaudio may be too slow starting up.
Try ExecStartPre=/bin/sleep 5 in the [service] section.

@Thomson-Skelington
Copy link
Author

Thomson-Skelington commented Sep 21, 2021

Could be a race condition. Pulseaudio may be too slow starting up.
Try ExecStartPre=/bin/sleep 5 in the [service] section.

I just tried and I have the same error
Will try with a higher value
EDIT: it works with a value of 30, I will try reducing to the minimum
EDIT2: I managed to make it work using a sleep 3 and a Restart=always and RestartSec=1 (I might not need the sleep anymore but Pulseaudio needs some time to start anyway)

@Thomson-Skelington
Copy link
Author

The final service setup

[Unit]
Description=Scream Receiver
After=pulseaudio.service network-online.target
Wants=pulseaudio.service

[Service]
User=pi
Type=simple
ExecStartPre=/bin/sleep 3
ExecStart=/home/pi/scream/Receivers/unix/build/scream -u -p 4011 -v
Restart=always
RestartSec=1

[Install]
WantedBy=default.target

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