diff options
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | fq | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/README.md b/README.md index cc7fe58..f31ab40 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@ Two helper scripts are provided: `tmux` and GNU `tail`). `fq` outputs the log of the currently running jobs, exiting when the -jobs are done. +jobs are done. If no job is running, the output of the last job is +shown. (A pure shell implementation of `nq` is provided as `nq.sh`. It needs `flock` from util-linux, and only has a timer resolution of 1s. diff --git a/fq b/fq index 8cf3832..99774fe 100755 --- a/fq +++ b/fq @@ -1,11 +1,17 @@ #!/bin/sh -# fq - tail -f the queue outputs, quitting when the job finishes +# 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 |