#! /bin/sh set -x # Why the heck is this eating 100% CPU in an unkillable state? . $(dirname $0)/common.sh queue () { find audio video -name env.json \ | while read envjson # This is the line that's dying at 100% CPU do dir=${envjson%/env.json} cat $envjson \ | jq --arg dir "$dir" '.directory = $dir' done } cat </dev/null | jq -nR '[inputs]'), "audio": $(ls */*/.mp3 2>/dev/null | jq -nR '[inputs]') }, "queue": $(queue | jq --slurp), "status": { "reader": $(cat status.reader | jq -nR '[inputs][0]'), "encoder": $(cat status.encoder | jq -nR '[inputs][0]') } } EOD