3 ms·
So this is somehow a better version of &? Supporting only a single queue makes this no different than `nohup`, etc. Even the examples provided describe what ca
by soheil 6y ago
So this is somehow a better version of &? Supporting only a single queue makes this no different than `nohup`, etc.
Even the examples provided describe what can already be done by appending a simple & to a command:
% mkdir -p /tmp/downloads
% 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
...
what about?
wget http://mymirror/big1.iso &
wget http://mymirror/big2.iso &
It all just seems to be trying very hard to be something it's not, but I can't put my finger on it.
- CGamesPlay 6y agoYou're aware that & doesn't actually queue, right? That would run all commands in parallel. nq runs them serially.
- soheil 6y agoSo this? ( wget http://mymirror/big1.iso; wget http://mymirror/big2.iso ) &
- CGamesPlay 6y agoYes, this is closer to what nq is doing :) This comparison is addressed over here: https://news.ycombinator.com/item?id=25920995 https://news.ycombinator.com/item?id=25920995
- soheil 6y agoI see, what about this then?:) Run the queue: mkfifo q ( while True; do sh q; done ) & Schedule jobs: echo wget http://mymirror/big1.iso > q echo wget http://mymirror/big1.iso > q This has the added benefit of supporting multiple queues.
- CGamesPlay 6y agoWatch out, FIFOs don't have buffers, so that echo will block. Running the echos in the background causes a race condition on execution order.
- soheil 6y agoNamed pipes actually do have buffers, you might be thinking about unnamed pipes created by bash.
- JNRowe 6y agoIt does support multiple queues. The example you pasted shows how multiple queues work by giving unique queue locations in NQDIR.
- greggyb 6y agoIt supports a single queue per directory. Unless you're using an ancient filesystem, you should be able to create more than enough queues to handle anything you need.