Max2Play Home › Forums › Max2Play as Squeezebox (Player / Server) › max2play/squeezelite process maintenance & autostart changes › Reply To: max2play/squeezelite process maintenance & autostart changes
Hi,
it mainly depends on what exactly happens once your BT-speakers are shut down. As I understand from your post Squeezelite is still running after BT-speakers are not available anymore. The scripts you posted seems to check for the BT-connection and either starts or stops the squeezelite process. We have a cronjob in the Max2Play-Image that checks for a running Squeezelite and starts it automatically if „Autostart“ is enabled. If the BT-Connection is not available this should normally fail (you should check this). So simplest thing to do would be a script, that just stops squeezelite once the BT-connection is not available anymore and start this script with the /etc/rc.local at startup.
I took the hcitool-part from the other script. Didn’t test it, as I don’t have a Bluetooth Speaker.
#!/bin/bash
while (sleep 5)
do
running_squeezelite=$(ps -Al | grep squeezelite | wc -l)
if [ "0" -lt "$running_squeezelite" ]; then
connected=$(hcitool con) > /dev/null
if [[ $connected =~ .*${address}.* ]] ; then
#everything is fine
else
/etc/init.d/squeezelite stop
fi
fi
done