Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: jeff_69_fr on October 20, 2017, 07:02:12 AM
-
Hello, I'm on issue to obtain the autostart of an ASH script on PiCorePlayer.
this script is working well from the command line,
but no way to obtain the script starting normally from bootlocal
- with / without using sudo
- using / not using the paths
below my bootlocal.sh file and the script
I don' find any related post, sorry if the point is obviousl I'm a newbie on such topics
thanks in advance for your advises
my current bootlocal.sh
[#!/bin/sh
# put other system startup commands here
/opt/eth0.sh
GREEN="$(echo -e '\033[1;32m')"
echo
echo "${GREEN}Running bootlocal.sh..."
#pCPstart------
/home/tc/www/cgi-bin/do_rebootstuff.sh 2>&1 | tee -a /var/log/pcp_boot.log
#pCPstop------
/usr/local/etc/init.d/lcdproc-server start
/usr/local/etc/init.d/pikeyd start
/usr/local/etc/init.d/slimmer start
python /usr/local/etc/init.d/shutdown-button.py
/bin/ash /usr/local/etc/init.d/squeezelite_led.sh &
and the script / to activate 2 leds depending of squeezelite running or not
#!/bin/ash
# wiringPy mode
LED1=3
LED2=5
# set-up
setup()
{
gpio mode $LED1 out
gpio write $LED1 0
gpio mode $LED2 out
gpio write $LED2 0
}
#loop
loop()
{
squeezelite=$(ps -ef | grep MainPlayer | grep -v "grep" | wc -l)
if [ $squeezelite -eq 0 ]; # If squeezelite isn't playing
then
gpio write $LED1 0
gpio write $LED2 1
else
gpio write $LED1 1
gpio write $LED2 0
fi
sleep 1
}
# main
setup
while true;
do
loop
done
-
Hi jeff_69_fr
/bin/ash /usr/local/etc/init.d/squeezelite_led.sh &
That doesn't look right. It should look like:
/usr/local/etc/init.d/squeezelite_led.sh &
-
Hi Rich, that doesn't work, previously tested ko and just redo with the same result :-[
previous runs was Ko using
- nothing as advised
- Bash and Ash, as managed with success for python script (listed just before on the bootlocal.sh file
- the same with full path as /bin/ash or /bin/bash or /usr/local/bin/bash
thanks for your support !!
below the current bootlocal / extract
/usr/local/etc/init.d/lcdproc-server start
/usr/local/etc/init.d/pikeyd start
/usr/local/etc/init.d/slimmer start
python /usr/local/etc/init.d/shutdown-button.py
/usr/local/etc/init.d/squeezelite_led.sh &
extract of the started processes after booting
877 root /sbin/udevd --daemon
895 root [kworker/2:2]
946 root crond
969 root {bootlocal.sh} /bin/sh /opt/bootlocal.sh
970 tc -sh
1163 root /usr/local/sbin/lircd --device=/dev/lirc0 --log=/var/log/pcp_lir
1231 root [ipv6_addrconf]
1252 root /usr/local/sbin/sshd
1263 root /usr/local/bin/squeezelite -n MainPlayer -o hw:CARD=sndrpihifibe
1298 root /usr/local/sbin/busybox-httpd -h /home/tc/www
2716 root sshd: tc@pts/0
5144 nobody /usr/local/sbin/LCDd -c /usr/local/etc/LCDd.conf
5146 root /usr/local/sbin/pikeyd -d
5151 root /usr/local/bin/slimmer --lmshost 192.168.0.210 --lmsport 9001 --
5153 root python /usr/local/etc/init.d/shutdown-button.py
5155 tc -sh
5196 tc ps
extract of the started processes after manual start of the script
877 root /sbin/udevd --daemon
895 root [kworker/2:2]
946 root crond
969 root {bootlocal.sh} /bin/sh /opt/bootlocal.sh
970 tc -sh
1163 root /usr/local/sbin/lircd --device=/dev/lirc0 --log=/var/log/pcp_lirc.log
1231 root [ipv6_addrconf]
1252 root /usr/local/sbin/sshd
1263 root /usr/local/bin/squeezelite -n MainPlayer -o hw:CARD=sndrpihifiberry -a 80 4 1 -i
1298 root /usr/local/sbin/busybox-httpd -h /home/tc/www
2716 root sshd: tc@pts/0
5144 nobody /usr/local/sbin/LCDd -c /usr/local/etc/LCDd.conf
5146 root /usr/local/sbin/pikeyd -d
5151 root /usr/local/bin/slimmer --lmshost 192.168.0.210 --lmsport 9001 --input /dev/pikeyd
5153 root python /usr/local/etc/init.d/shutdown-button.py
5155 tc -sh
5197 root {squeezelite_led} /bin/ash /usr/local/etc/init.d/squeezelite_led.sh
5241 root sleep 1
5242 tc ps
-
Perhaps you need to background your python script?
-
Hi jeff_69_fr
Here's your problem:
969 root {bootlocal.sh} /bin/sh /opt/bootlocal.sh
One of your commands doesn't exit and return control to bootlocal, so your squeezelite_led.sh command never gets executed.
-
Curaga, Rich thanks you both for your advises
effectively all is now working with the python script in background
Thx again !!
-
Thanks Tiny Core guys for helping jeff_69_fr out. :)
hi jeff_69_fr,
Just a little word of warning, as piCorePlayer is not just piCore, sometimes you may be advised to use the "product" forum for support rather than the Tiny Core forums.
regards
Greg
-
Hi Greg Erskine
Seeing how it wasn't piCorePlayer specific I didn't feel it was out of line, but thanks for passing on the heads up to jeff_69_fr.