I tried
with no luck. How can I tell the state of squeezelite ($1)?Code:#!/bin/sh #---------------------------------------------------------------------------------------- # Script for turning RPi3 USB output on/off when Squeezelite player is turned on/off. # This script requires that extension uhubctl.tcz is installed. # Enter the path to this "Power On/Off Script" on the pCP Squeezelite Settings page. # https://github.com/mvp/uhubctl#raspberry-pi-b2b3b #---------------------------------------------------------------------------------------- # squeezelite -S /home/tc/usb-power-on-off.sh # # squeezelite sets $1 to: # 0: off # 1: on #---------------------------------------------------------------------------------------- case $1 in 0) /usr/local/sbin/uhubctl -l 1-1 -p 4 -a 0 >/dev/null 2>&1 ;; 1) /usr/local/sbin/uhubctl -l 1-1 -p 4 -a 1 >/dev/null 2>&1 ;; esac
Results 21 to 30 of 75
-
2020-11-14, 14:43 #21
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
-
2020-11-14, 15:06 #22
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
I also tried the built in "powerscript.sh" which sends the $1 state to an ssh terminal and that doesn't work either. Am I wrong in expecting that toggling the power of piCorePlayer in Material skin or the Default skin should change the state of $1 and display it in the terminal?
-
2020-11-14, 15:36 #23
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,341
-
2020-11-14, 16:24 #24
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
-
2020-11-14, 16:36 #25
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
-
2020-11-15, 04:52 #26
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,341
My suggestion is in the script.
The following is my version which just creates lots of output to shows which parts of script are executed.
Squeezelite V1.9.7-1283 was tested on a Rasbian Buster
Squeezelite is standard Ralphy and has GPIO build option.
Run from command line with "-S /home/pi/myscript.sh"
Code:#!/bin/sh #---------------------------------------------------------------------------------------- # Script for turning RPi3 USB output on/off when Squeezelite player is turned on/off. # This script requires that extension uhubctl.tcz is installed. # Enter the path to this "Power On/Off Script" on the pCP Squeezelite Settings page. # https://github.com/mvp/uhubctl#raspberry-pi-b2b3b #---------------------------------------------------------------------------------------- # squeezelite -S /home/tc/usb-power-on-off.sh # # squeezelite sets $1 to: # 0: off # 1: on #---------------------------------------------------------------------------------------- NOW=$(date +"%m-%d-%Y %T") echo "--- $NOW ---" >>/tmp/powerlog.txt echo "Args: " "$@" >>/tmp/powerlog.txt case $1 in 0) echo "Arg dollar 1 value 0 " >>/tmp/powerlog.txt ;; 1) echo "Arg dollar 2 value 1 " >>/tmp/powerlog.txt ;; esac echo "---- End run ---- " >>/tmp/powerlog.txt
Code:--- 11-15-2020 11:49:12 --- Args: 0 Arg dollar 1 value 0 ---- End run ---- --- 11-15-2020 11:49:12 --- Args: 1 Arg dollar 2 value 1 ---- End run ---- --- 11-15-2020 11:49:13 --- Args: 0 Arg dollar 1 value 0 ---- End run ---- --- 11-15-2020 11:49:13 --- Args: 1 Arg dollar 2 value 1 ---- End run ----
-
2020-11-15, 07:35 #27
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
-
2020-11-15, 07:41 #28
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 20,341
You don't show your command line
The first line indicates which shell to use. IIRC pcp doesn't have a shell it uses busybox - so there may be no "/bin/sh"
There is a pcp extension called bash.tcz whic may provide "/bin/bash "which may also then create a link to "/bin/sh"
For example if I change the first line on my system to "#!/bin/badshell" I get the following message
Code:sh: 1: /home/pi/myscript.sh: not found
Last edited by bpa; 2020-11-15 at 13:06. Reason: Correct shell paths
-
2020-11-15, 08:03 #29
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614
-
2020-11-15, 08:07 #30
- Join Date
- Jan 2010
- Location
- Hertfordshire
- Posts
- 6,614