diff --git a/bin/mpd-monitor b/bin/mpd-monitor index 7f20022..5a09399 100755 --- a/bin/mpd-monitor +++ b/bin/mpd-monitor @@ -1,4 +1,7 @@ #!/bin/sh + +# quit if another instance is already running +[ -z $(pidof mpd-monitor) ] && echo "mpd-monitor already running";exit ID=$(mpc current -f %id% ) mpc idleloop | while read -r event; do @@ -7,7 +10,7 @@ mpc idleloop | # get current id to compare to init id NEW_ID=$(mpc current -f %id%) - # if a player even is output, but the track has not changed, skip rest of loop + # if a player event is output, but the track has not changed, skip rest of loop [ "$NEW_ID" != "$ID" ] || continue ID=$NEW_ID