3 ms·
You're aware that & doesn't actually queue, right? That would run all commands in parallel. nq runs them serially.
by CGamesPlay 6y ago
You'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.