nq — screenshot of github.com

nq

nq is a lightweight Unix command line queue utility for ad-hoc job execution. It requires no daemons, relying on filesystem-level flock(2) for synchronization and sequential task processing.

Visit github.com →

Questions & Answers

What is nq?
nq is a set of Unix command-line utilities designed to create lightweight, ad-hoc job queue systems. It allows users to enqueue commands for sequential background execution without requiring any long-running processes or daemons.
Who should use nq?
nq is suitable for developers, system administrators, and anyone needing a simple, robust method to queue command-line jobs on a POSIX-compliant system. It's particularly useful for local ad-hoc task sequencing or for managing small job queues across multiple terminals.
How does nq compare to other job schedulers like at or task-spooler?
Unlike at and batch which schedule jobs by time or system load and have fixed queues, nq runs jobs strictly in sequence, using any directory as a queue. It differs from task-spooler by relying on filesystem flock(2) for synchronization and outputting job IDs as filenames, enabling ls -F for status.
When is nq a good choice for job queuing?
nq is a good choice for scenarios like building multiple Makefile targets in sequence, managing sequential file downloads, running benchmarks with various configurations, or as a more advanced nohup replacement where job order and output logging are critical.
How does nq handle job synchronization and logging?
nq enforces job order and exclusive execution using flock(2) on output files named ,<TIMESTAMP>.<PID>. The file handle lock is shared with the child process and releases upon termination. STDOUT and STDERR are redirected to these log files, with the +x bit set on the currently running job's log for easy status checks via ls -F.