Trauma writes

Hi, and thanks for this great piece of software.

While i’m trying to make upmpdcli and shairport-sync play/stop each other nicely, I’m failing to controlling shairport-sync with "onstop" or "onstart" directives :

Mar 19 21:47:48 cabinette upmpdcli[1245]: sh: /root/wlspk/disconnect-shairpot.sh: Permission denied
Mar 19 21:47:48 cabinette upmpdcli[1245]: :2:src/mpdcli.cxx:562::MPDCli::playId: /root/wlspk/disconnect-shairpot.sh failed

and here is permissions of the script disconnect-shairpot.sh : `-rwxrwxrwx 1 upmpdcli audio 50 Mar 19 21:44 disconnect-shairpot.sh `

And the content of the highly elaborated script:

#!/bin/bash

/usr/bin/shairport-sync -D && exit 0

In my fisrt attempt I’ve simply put onstart = "/usr/bin/shairport-sync -D" in upmpdcli.conf, didn’t got it to work neither :

Mar 19 21:22:30 cabinette upmpdcli[921]: sh: /usr/bin/shairport-sync -D: No such file or directory
Mar 19 21:22:30 cabinette upmpdcli[921]: :2:src/mpdcli.cxx:562::MPDCli::playId: "/usr/bin/shairport-sync -D" failed

While which shairport-sync gives : /usr/bin/shairport-sync

Any help on this would be greatly appreciated.

medoc92 writes

The perm denied is probably on one of the directories in the path /root/wlspk.

/root is usually drwx------

If this is the case, maybe create /home/upmpdcli with appropriate permissions ?

Trauma writes

Damn it! Of course…

Putting the script in a path with appropriate permissions and executing both process with same user did the trick!! My bad.

By the way, despite it’s actually working, upmpdcli still throw this errors :

Mar 21 20:50:07 cabinette upmpdcli[234]: :2:src/mpdcli.cxx:562::MPDCli::playId: /home/upmpdcli/disconnect-shairpot.sh failed
Mar 21 20:50:24 cabinette upmpdcli[234]: :2:src/mpdcli.cxx:227::MPDCli::updStatus: /home/upmpdcli/reconnect-shairpot.sh failed

And in the same situation, both process running with same user, with an upmpdcli configuration pointing directly to shairport-sync binary (in this case it really fails): Mar 21 20:56:22 cabinette upmpdcli[647]: :2:src/mpdcli.cxx:544::MPDCli::play: "/usr/bin/shairport-sync -D" failed

Thanks.

medoc92 writes

The messages just indicate that a system(3) call returned non-zero (I should print the value…). man system for the reasons why this may occur.

If the scripts otherwise do what they’re supposed to do, you should make sure that they set the exit status to 0.

Trauma writes

Once more you are totally right. The shairport-sync -R|D command always return 1.

Forcing exit code to 0 in the script fixed the log messages.

Thanks again for your support.