#! /bin/sh . $(dirname $0)/common.sh run_in () { ( cd $1; shift "$@" ) } while sleep 2; do for mtype in audio video; do ls $mtype | while read d; do encode=/scripts/$mtype.encode.sh workdir=$mtype/$d [ -f $workdir/read.finished ] || continue echo "$workdir" > $OUTDIR/$mtype.status setenv status "encoding" if ! run_in $workdir $encode; then log "$encode failed" else rm -rf $workdir fi done done echo "idle" > $OUTDIR/$mtype.status done # vi: ts=2 sw=2 et ai