mikebrady / shairport-sync-for-openwrt

This is an OpenWrt package for building and installing Shairport Sync
45 stars 22 forks source link

Config not working due to start-up script problem #2

Closed ericwongcm closed 10 years ago

ericwongcm commented 10 years ago

Changing airplay broadcast in /etc/config/airplay does not work.

I see the process is always running as shairport -d

I can change the broadcast without problem if I manually start shairport-sync like this shairport -d -a Test

This means the problem is not in the code/binary but there is some problem in the start-up script, resulting in the config file's broadcast name not used when starting shairport-sync. It also appears that the start-up script does not conform to guideline.

Can someone refer to this Openwrt shairport's start-up script and configuration file, and update shairport-sync's accordingly? https://github.com/openwrt/packages/tree/master/multimedia/shairport

Sorry, I can't do this because I can't fully understand how the script works. I won't want to submit any changes I make/try which might cause more problems....

mikebrady commented 10 years ago

Thanks for the report. I'll have a look at this.

mikebrady commented 10 years ago

Hi there. I'm having a problem replicating this problem. Could you give an example? Maybe send the /etc/config/airplay file? All the best.

mikebrady commented 10 years ago

Oops – didn't mean to close the issue.

ericwongcm commented 10 years ago

Something like this didn't work when I try it on Openwrt using the init script you wrote. Due to this and other problems in the init script in your source code, I had actually resort to use Openwrt latest shairport's init script and config file to fit my own purpose. What I mean is fixing this config file or relevant portion in the init script is not going to be sufficient without major modification of the init script you are using for Openwrt.

#Defaults are as follows                    
       option name 'Test'                             
#       option device 'hw:0'                              
#       option latency 99400                              
#       option port 5000   

Another bug/problem in your configuration file is shairport-sync will not work properly if this part is comment out like this

#Uncomment the following line (may be uncommented already) -- all parameters will be default 
#config airplay
mikebrady commented 10 years ago

Thanks for this. I think the problem is not so much a technical one – it's just that there is too much stuff in the sample file and it's too cluttered. So, as a trial, I suggest you delete the entire content of /etc/config/airplay and replace it with exactly the following:

config airplay
    option name Test

Then when you start up Shairport Sync using: /etc/init.d/airplay start you should be able to see it running using the command line commands $ps aux | grep sha and it should look something like this:

1768 root     17876 S    shairport -d -a Test

(The two numbers will be different, of course.) If that works, then I suggest you add one option at a time, for example:

config airplay
    option name Test
    option device 'hw:0'

giving

1768 root     17876 S    shairport -d -a Test -- -d hw:0

and check after each edit that it works properly. Please let me know how this works out. If it works out okay I'll change the sample and documentation...

ericwongcm commented 10 years ago

Sorry for the late reply.

I have tried both config you posted. Both works fine using the init.d/airplay in your source code. I think the problem in your config is probably due to the order of the options, which you I think you have already realized.

When you do your modification, please do reference to the Openwrt shairport's start-up script. It will likely solve/address the problem you mentioned in the start-up script, especially the part that attach the temporarily store the process number and the way the process is killed.

Btw, if you try to do this, you get this error message. Openwrt's shairport start-up script doesn't have such error. root@Openwrt:~# /etc/init.d/airplay restart Failed to kill daemon: No such file or directory

mikebrady commented 10 years ago

Many thanks. I'll certainly modify the options as you suggest and I'll try to take account of your suggestions in the next update. There will be quite a few changes...

mikebrady commented 10 years ago

Just in relation to the last error message: When you say 'restart', it works by stopping the existing process and then starting another copy of it, i.e. restart = stop + start. The error is merely that there wasn't a process to stop – it still goes on to start the new copy anyway. (In the same circumstances, if you said '/etc/init.d/airplay start' there would have been no error message.) So, not a bug, rather a feature :)