summary refs log tree commit diff
path: root/fq.sh
blob: 99774feb2a0adab8da5e20613c261ecb782ece6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
# fq - tail -F the queue outputs, quitting when the job finishes

tailed=false
for f in ${NQDIR:-.}/,*; do
	if ! nq -t $f; then
		tailed=true
		printf '==> %s\n' "$f"
		tail -F $f & p=$!
		nq -w $f
		kill $p
	fi
done

if ! $tailed; then
	cat $f
fi