#!/bin/bash while true do STATUS=`pactl list sources short |grep alsa_input |awk '{print $7}'`; echo $STATUS if [[ "$STATUS" == "RUNNING" ]] then echo "all good with audio device"; else if [[ "$STATUS" == "SUSPENDED" ]] then echo "something up with audio - restarting alsa and pulse"; ./reboot-audio.sh fi fi sleep 5; done