about summary refs log tree commit diff
path: root/nqtail.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nqtail.sh')
-rwxr-xr-xnqtail.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/nqtail.sh b/nqtail.sh
new file mode 100755
index 0000000..d2d3816
--- /dev/null
+++ b/nqtail.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# nqtail - 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