-
-
Notifications
You must be signed in to change notification settings - Fork 567
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
run_this_before_play_begins doesn't work when running as service #152
Comments
Try using full pathnames? |
Hi - thanks for the reply. I am already using full pathnames. Here's the session control section in full: sessioncontrol = Any other suggestions gratefully accepted. It's a nice to have, rather than a must have for me, but does enable some cool stuff to happen, so it would be nice to have it working... |
Thanks for the information. The environment that those scripts run in is a bit weird. Here is a little script that works in the service mode on the Raspberry Pi running Wheezy:
You'll see different results depending on whether Shairport Sync is run from a command line or as a service. Notice that both the working directory and the PATH are different, so it's probably best to use full path names for everything inside the script too. |
Apologies for the misunderstanding. I see what you mean now. Your suggestion has resolved the issue. Thanks very much for all you've done on this project - it's helping me do multi-room audio for a song! |
Thanks. Actually, I coulda been a bit more explicit in what I wrote... |
Hi mikebrady! /etc/shairport-sync.conf:
script /usr/local/bin/squeezelite_stop:
script /usr/local/bin/squeezelite_start:
If I begin to stream sound to Raspberry via shairport-sync, squeezelite doesn't stop. If I run these scripts manually, squeezelite stops and starts. What's wrong with it? |
Thanks for your kind words! It sounds like a problem due to the different environment the scripts run in when they are launched by Shairport Sync. The scripts will be running under the user See some of the previous comments and #152 (comment) for a script to do some experimentation. |
|
Could you post here please an example of working |
That is an example of a script that could be a The scripts you list above do not give a full path name for Beyond this, I'm afraid you'll have to learn about Linux elsewhere. |
Thank you very much for your answer! I'll try this and defenitely will learn more about Linux. |
chasylexus, did you figure out a solution to this. I am trying to do the same thing. I had it working in Wheezy with simple scripts like you have listed above, inserted in the start-stop-daemon with -B and -E flags. I am assuming you had the same setup? I've no luck in Jessie thus far...my knowledge of linux is probably similar to yours... Thanks. (Sorry to hijack this thread Mike...) |
wcsuther, yes I solved this but now I don't use this.
You can obtain right substitution for Good luck! |
I tried that, but to no avail. I added user shairport-sync to the sudo group, ran
Still no luck. I'll keep digging, thanks. |
As I remember I also added shairport-sync to all groups that included pi user. |
Are you logged in as the shairport-sync user when trying your scripts? If not, do that. - Since that's the environment the script runs in, you can find and fix a lot of errors and it's much easier that way. (One way to do that is to do this "sudo su - shairport-sync") Apologies if you've done this, I haven't been following this thread. I just had a thought that maybe sudo needs a password. You can more easily check if something isn't in the PATH too (though you may have found all the cases already). |
I am using this feature to mute/unmute an amplifier... here is a snippet run_this_before_play_begins = "/usr/bin/sudo /usr/local/bin/unmute" and my sudo entry... This works perfect for me. On Mon, Feb 29, 2016 at 2:37 PM, rkam notifications@github.com wrote:
Bill Peck |
Thank you chasulexus, rkam, and p3ck...it was a password issue. I hadn't set my /etc/sudoers correctly. It's working flawlessly now switching between squeezelite and shairport-sync... Thanks again. |
Thanks to everyone on this thread, I was able to get shairport-sync to stop the motion service while music is playing and start it again when the music stops. (My Pi doesn't have enough CPU power to keep the music playing glitch free when motion is active.) In case it helps anyone else, here are the settings I used:
And I also needed to add shairport-sync to my sudoers:
@mikebrady shairport-sync is a beautiful piece of work! Thanks again to all. |
I have entries in my configuration to run a script before play starts and another after play finishes.
If I run shairport-sync as a service, these scripts do not get run. However, if I run shairport-sync at the command line (as root) the scripts are run as expected.
I am running on a raspberry pi, using raspbian wheezy. The scripts are located in a user's folder and have permissions set by chmod 755.
What could I be doing wrong here?
The text was updated successfully, but these errors were encountered: