Did I say 'a moment'? That was a frustrating hour and a half!
First I'd neglected to launch Squeezelite into the background, so I was getting all sorts of confusing issues - sometimes things would work, sometimes they wouldn't. Second, some more of the basic built-in commands weren't doing what they should, so I've had to provide the full path to /bin/echo and /usr/bin/awk (and change what awk was doing, because awk '{printf "%s ", $1}' was giving me an invalid token with /usr/bin/awk). There's something weird there - are the built-in versions not available in a udev shell perhaps? Anyway - this now seems to work for me. @Bogg - if you're up for another test, replace the whole SQLITErestart() function with this: Code: -------------------- SQLITErestart() { local logfile=$1 local attempts=5 # number of tries local interval=0.25 # interval between tries (seconds) local result local count=$attempts local status="Squeezelite not running." while [ "$status" == "Squeezelite not running." ]; do if [ $((count--)) -le 0 ]; then log "Squeezelite failed to initialize within $attempts attempts." $logfile exit 1 fi # result=$(sudo /usr/local/etc/init.d/squeezelite restart) log "Forcing a restart of Squeezelite..." $logfile SQLITEstop # result="$(sudo /usr/local/etc/init.d/squeezelite start)" # log "$result" $logfile # /usr/local/bin/squeezelite -n piCorePlayer -o hw:CARD=DragonFly,DEV=0 -a "80 4 1" & /usr/local/bin/squeezelite -n piCorePlayer -o hw:CARD=M6,DEV=0 -a "80 4 1" -v & sleep $interval local PID=$(/bin/busybox pgrep /usr/local/bin/squeezelite | /usr/bin/awk '{print $1}') # log "Squeezelite process ID = $PID" $logfile sudo /bin/echo "$PID" > /var/run/squeezelite.pid status="$(sudo /usr/local/etc/init.d/squeezelite status)" log "$status" $logfile done # determine cardname from squeezelite process id local PID=$(sudo /usr/local/etc/init.d/squeezelite status | awk -F PID= {'print $2'}) local cardname=$(ps | grep $PID | awk -F CARD= {'print $2'} | awk -F , {'print $1'}) log "Restoring alsa settings for $cardname" $logfile sudo /usr/local/sbin/alsactl restore $cardname } -------------------- ------------------------------------------------------------------------ chill's Profile: http://forums.slimdevices.com/member.php?userid=10839 View this thread: http://forums.slimdevices.com/showthread.php?t=113661 _______________________________________________ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix