chill wrote:
> I don't think the complexity of testing whether squeezelite generates a
> process id and then retrying would be necessary...
I'd forgotten about the 'status' option of the built-in squeezelite
script, which makes it really simple to see if squeezelite has started
up. So I improved my script to be a little more sophisticated than just
waiting 0.25 seconds. It will now retry up to 5 times, with 1 second
between each. Obviously you can tune those values. In my case I've
found that it always starts first time, so evidently the tiny delay
introduced by calling an extra script is enough. YMMV.
Here's my improved script.
Code:
--------------------
#!/bin/sh
attempts=5 # number of tries
count=$attempts
while [ "$(sudo /usr/local/etc/init.d/squeezelite status)" == "Squeezelite
not running." ]; do
if [ $((count--)) -le 0 ]; then
echo "Squeezelite failed to initialize within $attempts
attempts." >> /var/log/pcp_DAC.log
exit 1
fi
echo "Attempting to start squeezelite" >> /var/log/pcp_DAC.log
sudo /usr/local/etc/init.d/squeezelite restart >> /var/log/pcp_DAC.log
sleep 1 # time interval (seconds) between tries
done
--------------------
------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=113661
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix