|
NAMEnq —
job queue utility
SYNOPSIS
DESCRIPTIONThenq utility provides a very lightweight queuing
system without requiring setup, maintenance, supervision or any long-running
processes.
Job order is enforced by a timestamp You enqueue(!) new jobs into the queue by running nq command line
... The job id (a file name relative to The options are as follows:
ENVIRONMENT
FILESnq owns all files in NQDIR
(respectively .) which start with
“, ” or
“., ”. These files are created according
to the following scheme:
,hexadecimal-time-stamp.pid EXIT STATUSThenq utility exits 0 on success, and >0 if an error
occurs; unless test mode is used, in which case exit status
1 means there is a job running.
On fatal errors, exit codes 111 and 222 are used. EXAMPLESBuild make(1) targetsclean , depends ,
all , without occupying the terminal:
% nq make clean % nq make depends % nq make all % fq ... look at output, can interrupt with C-c any time without stopping the build ... Simple download queue, accessible from multiple terminals: % alias qget='NQDIR=/tmp/downloads nq wget' % alias qwait='NQDIR=/tmp/downloads fq -q' window1% qget http://mymirror/big1.iso window2% qget http://mymirror/big2.iso window3% qget http://mymirror/big3.iso % qwait ... wait for all downloads to finish ... As nohup(1) replacement (The benchmark will run in background, every run gets a different output file, and the command line you ran is logged too.): % ssh remote remote% nq ./run-benchmark ,14f6f3034f8.17035 remote% ^D % ssh remote remote% fq ... see output, fq exits when job finished ... TRICKSThe "file extension" of the log file is actually the PID of the job.nq runs all jobs in a separate process group, so you
can kill an entire job process tree at once using
kill(1)
with a negative PID. Before the job is started, it is the PID of
nq , so you can cancel a queued job by killing it as
well.
Thanks to the initial sh
job id Creating INTERNALSEnforcing job order works like this:ASSUMPTIONSnq will only work correctly when:
SEE ALSOfq(1), tq(1).Alternatives to the AUTHORSLeah Neukirchen <leah@vuxu.org>CAVEATSAll reliable queue status information is in main memory only, which makes restarting a job queue after a reboot difficult.LICENSEnq is in the public domain.
To the extent possible under law, the creator of this work has waived all copyright and related or neighboring rights to this work.
Visit the GSP FreeBSD Man Page Interface. |