TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Unix command line queue utility

52 pointsby evandrixover 9 years ago

6 comments

justin_vanwover 9 years ago
<p><pre><code> $ mkfifo ~&#x2F;.jobqueue $ parallel :::: ~&#x2F;.jobqueue </code></pre> now, from another terminal:<p><pre><code> echo ls &gt; ~&#x2F;.jobqueue </code></pre> Tada!<p>for a remote job queue, use nc instead of a fifo<p>for a job queue with a buffer, use a file, and run $ parallel :::: &lt;(tail -f thefile) you can even truncate the file from time to time.<p>Of course, this doesn&#x27;t capture the context you are in, such as your current directory or the value of shell variables.
评论 #10127743 未加载
评论 #10127558 未加载
kovekover 9 years ago
This stackoverflow answer[0] shows how you can queue jobs even after you start running other processes in your queue. Essentially, you can do:<p><pre><code> sleep 2; echo &quot;A&quot; &amp;&amp; sleep 2 ; echo &quot;B&quot; &amp;&amp; sleep 2 ; echo &quot;C&quot; # Quickly Ctrl-Z fg &amp;&amp; sleep 2 ; echo &quot;D&quot; </code></pre> and you will see A\nB\nC\nD\n slowly printed out in your terminal.<p>[0]: <a href="http:&#x2F;&#x2F;superuser.com&#x2F;a&#x2F;345455" rel="nofollow">http:&#x2F;&#x2F;superuser.com&#x2F;a&#x2F;345455</a>
CyberShadowover 9 years ago
Could you please add some usage examples or elaborate on when this tool would be useful? For example,<p>&gt; building several targets of a Makefile<p>As opposed to `make &amp;&amp; sudo make install` ?<p>&gt; downloading multiple files one at a time<p>As opposed to `(wget url1 &amp;) ; (wget url2 &amp;)` ?<p>&gt; or simply as a glorified `nohup`<p>As opposed to `nohup` ?
评论 #10126369 未加载
评论 #10126248 未加载
jschwartziover 9 years ago
Which systems guarantee monotonic behavior for gettimeofday()? I can&#x27;t think of any. I hope there&#x27;s no behavior in nq which relies on monotonicity other than file naming, because otherwise you might run into some obscure issues.
pwgover 9 years ago
How does this differ from task spooler:<p><a href="http:&#x2F;&#x2F;vicerveza.homeunix.net&#x2F;~viric&#x2F;soft&#x2F;ts&#x2F;" rel="nofollow">http:&#x2F;&#x2F;vicerveza.homeunix.net&#x2F;~viric&#x2F;soft&#x2F;ts&#x2F;</a>
dslover 9 years ago
cat list.txt | xargs -n 1 -P 20 wget<p>Queues up 20 concurrent downloads with wget, for example.
评论 #10126576 未加载