Bash Script to Restart SqueezeLite If Not Playing Audio


Modify your server IP and player ID as needed:

#!/bin/bash
NOWPLAYING="`wget 'http://192.168.0.100:9000/status.html?player=64%3A71%3A12%3A1d%3Ab0%3Afb' -qO - | grep -i 'now playing'`"
if [ "x$NOWPLAYING" = "x" ]; then
        /etc/init.d/squeezelite restart
else
        echo Nope, its running.
fi

It’s run in my Crontab to restart the player because of wierd audio buffering issues.