All my stations (40+, I don't use the default moOde stations) are marked as being monitored, as I used to have drop-outs on all of them from time to time. Fact that almost all of them are flac hd stations may have to do something with that.
But your script is great! I've a SSH terminal running a tail -f on the /var/log/mpd/log, and I see your script kicks in from time to time, mostly with no hearable interruption. Also, resource consumption of your script is negligible.
Actually, I woke up at 4h30. Now it's 19h06, and the music keeps playing! Never had that experience! Not on moOde, and for sure not on Naim gear! Tx!
I combined both of your scripts in 1:
But your script is great! I've a SSH terminal running a tail -f on the /var/log/mpd/log, and I see your script kicks in from time to time, mostly with no hearable interruption. Also, resource consumption of your script is negligible.
Actually, I woke up at 4h30. Now it's 19h06, and the music keeps playing! Never had that experience! Not on moOde, and for sure not on Naim gear! Tx!
I combined both of your scripts in 1:
Code:
moode@moode:~ $ cat XRUN_restart.sh
#!/bin/bash
#XRUN_restart.sh - look for and attempt to recover from under-runs and timeouts in MPD.
while sleep 1;
do
LASTLOG=$( tail -n 1 /var/log/mpd/log )
STATUS=$(mpc status)
if [[ $STATUS = *"playing"* && $LASTLOG = *"xrun"* ]];
then
# echo "xrun matched"
mpc stop
mpc play
else
LASTLOG=$( tail -n 2 /var/log/mpd/log )
if [[ $STATUS != *"playing"* && $LASTLOG = *"timed out"* ]];
then
# echo "timeout matched"
mpc play
fi
fi
done