<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Alarm clock: How To Set Timeout For A Shell Command</title> <atom:link href="http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/feed/" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/</link> <description>Every answer asks a more beautiful question.</description> <lastBuildDate>Fri, 10 Feb 2012 19:55:56 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Bill</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-60671</link> <dc:creator>Bill</dc:creator> <pubDate>Tue, 12 Jul 2011 17:42:51 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-60671</guid> <description>Thanks, that works great!</description> <content:encoded><![CDATA[<p>Thanks, that works great!</p> ]]></content:encoded> </item> <item><title>By: me</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-55578</link> <dc:creator>me</dc:creator> <pubDate>Sat, 12 Feb 2011 23:13:23 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-55578</guid> <description>There is a command &quot;timeout&quot; in the latest Ubuntu Linux (10.10).
Example:
date; timeout 10m foo; date</description> <content:encoded><![CDATA[<p>There is a command &#8220;timeout&#8221; in the latest Ubuntu Linux (10.10).</p><p>Example:<br
/> date; timeout 10m foo; date</p> ]]></content:encoded> </item> <item><title>By: Pedro</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-55116</link> <dc:creator>Pedro</dc:creator> <pubDate>Mon, 24 Jan 2011 04:12:19 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-55116</guid> <description>God bless you!</description> <content:encoded><![CDATA[<p>God bless you!</p> ]]></content:encoded> </item> <item><title>By: Linus</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-49834</link> <dc:creator>Linus</dc:creator> <pubDate>Thu, 30 Sep 2010 16:23:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-49834</guid> <description>$ sh foo &amp; sleep 5 &amp;&amp; kill $! &amp; fg     ### (note the last &quot;&amp;&quot; is not &quot;&amp;&amp;&quot;, so you foreground the job immediately)</description> <content:encoded><![CDATA[<p>$ sh foo &amp; sleep 5 &amp;&amp; kill $! &amp; fg     ### (note the last &#8220;&amp;&#8221; is not &#8220;&amp;&amp;&#8221;, so you foreground the job immediately)</p> ]]></content:encoded> </item> <item><title>By: Fred</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-49019</link> <dc:creator>Fred</dc:creator> <pubDate>Wed, 25 Aug 2010 08:51:59 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-49019</guid> <description>Great, thanks!</description> <content:encoded><![CDATA[<p>Great, thanks!</p> ]]></content:encoded> </item> <item><title>By: Chris</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-45670</link> <dc:creator>Chris</dc:creator> <pubDate>Fri, 22 Jan 2010 21:37:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-45670</guid> <description>Thanks, the doalarm program worked very nicely for my purposes.</description> <content:encoded><![CDATA[<p>Thanks, the doalarm program worked very nicely for my purposes.</p> ]]></content:encoded> </item> <item><title>By: Cybergavin</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-44733</link> <dc:creator>Cybergavin</dc:creator> <pubDate>Tue, 17 Nov 2009 18:27:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-44733</guid> <description>Thanks.  Using the perl snippet is neat. Pretty much all UNIX systems come with bash and perl. So, this is cool.</description> <content:encoded><![CDATA[<p>Thanks.  Using the perl snippet is neat. Pretty much all UNIX systems come with bash and perl. So, this is cool.</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-42521</link> <dc:creator>Peter</dc:creator> <pubDate>Tue, 14 Jul 2009 06:22:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-42521</guid> <description>hey, you&#039;re right... that&#039;s funny.
I tried to dig some deeper using strace and funnily it does not show up then:
strace perl -e &quot;alarm shift @ARGV; exec @ARGV&quot; 5 cat &gt;/dev/null 2&gt;&amp;1
interesting issue, I do lack enough time to investigate
regards</description> <content:encoded><![CDATA[<p>hey, you&#8217;re right&#8230; that&#8217;s funny.<br
/> I tried to dig some deeper using strace and funnily it does not show up then:</p><p>strace perl -e &#8220;alarm shift @ARGV; exec @ARGV&#8221; 5 cat &gt;/dev/null 2&gt;&amp;1</p><p>interesting issue, I do lack enough time to investigate<br
/> regards</p> ]]></content:encoded> </item> <item><title>By: Muhammad</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-42507</link> <dc:creator>Muhammad</dc:creator> <pubDate>Mon, 13 Jul 2009 14:01:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-42507</guid> <description>Thanks Peter.
But the problem is appending &gt;/dev/null 2&gt;&amp;1 to the command redirects stdout and stderr for the &quot;command&quot; not for the perl. So even by appending this to the command i still get &quot;Alarm Clock&quot; after command terminates.
For example perl -e &#039;alarm shift @ARGV; exec @ARGV&#039; 5 foo arg1 arg2 &gt; /dev/null 2&gt;&amp;1 &#039; will redirect output and stderr from &#039;foo&#039; command not from the alarm command.
Thanks</description> <content:encoded><![CDATA[<p>Thanks Peter.</p><p>But the problem is appending &gt;/dev/null 2&gt;&amp;1 to the command redirects stdout and stderr for the &#8220;command&#8221; not for the perl. So even by appending this to the command i still get &#8220;Alarm Clock&#8221; after command terminates.</p><p>For example perl -e &#8216;alarm shift @ARGV; exec @ARGV&#8217; 5 foo arg1 arg2 &gt; /dev/null 2&gt;&amp;1 &#8216; will redirect output and stderr from &#8216;foo&#8217; command not from the alarm command.<br
/> Thanks</p> ]]></content:encoded> </item> <item><title>By: Peter</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-42498</link> <dc:creator>Peter</dc:creator> <pubDate>Mon, 13 Jul 2009 10:59:51 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-42498</guid> <description>Yup,
you can redirect the error output to stdout:
append  &quot;  &gt;/dev/null  2&gt;&amp;1&quot;  to the command</description> <content:encoded><![CDATA[<p>Yup,<br
/> you can redirect the error output to stdout:<br
/> append  &#8221;  &gt;/dev/null  2&gt;&amp;1&#8243;  to the command</p> ]]></content:encoded> </item> <item><title>By: Muhammad</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-42414</link> <dc:creator>Muhammad</dc:creator> <pubDate>Tue, 07 Jul 2009 20:05:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-42414</guid> <description>How can i suppress the stupid &#039;alarm clock&#039; output when the timeout expires?
I&#039;m running &quot;perl -e &#039;alarm shift @ARGV; exec @ARGV&#039; 5 cat&quot; it terminates the cat command after 4 seconds but then i get stupid &#039;Alarm clock&#039; output on the screen. I have to use this command in a shell script and i don&#039;t want this output.
I have tried redirecting standard error and std out but if i specify &gt;/dev/null at the end of cat command, it redirects &#039;cat&#039;&#039;s output not from perl -e..... Any ideas? Thanks a lot</description> <content:encoded><![CDATA[<p>How can i suppress the stupid &#8216;alarm clock&#8217; output when the timeout expires?<br
/> I&#8217;m running &#8220;perl -e &#8216;alarm shift @ARGV; exec @ARGV&#8217; 5 cat&#8221; it terminates the cat command after 4 seconds but then i get stupid &#8216;Alarm clock&#8217; output on the screen. I have to use this command in a shell script and i don&#8217;t want this output.</p><p>I have tried redirecting standard error and std out but if i specify &gt;/dev/null at the end of cat command, it redirects &#8216;cat&#8221;s output not from perl -e&#8230;.. Any ideas? Thanks a lot</p> ]]></content:encoded> </item> <item><title>By: Riccardo Murri</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-40478</link> <dc:creator>Riccardo Murri</dc:creator> <pubDate>Wed, 25 Feb 2009 14:15:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-40478</guid> <description>Warning: the tip from Professor Fapsanders only works if &quot;foo&quot; does not require any input (background processes cannot do that).
For the general case, you need to background the alarm process instead, as the sample &quot;timeout&quot; script does.</description> <content:encoded><![CDATA[<p>Warning: the tip from Professor Fapsanders only works if &#8220;foo&#8221; does not require any input (background processes cannot do that).</p><p>For the general case, you need to background the alarm process instead, as the sample &#8220;timeout&#8221; script does.</p> ]]></content:encoded> </item> <item><title>By: Jadu Saikia</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-39860</link> <dc:creator>Jadu Saikia</dc:creator> <pubDate>Thu, 15 Jan 2009 10:16:11 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-39860</guid> <description>Good one, I have to download and use it. Thanks.
The tip from Professor Fapsanders is also useful, we can make it more significant to kill the last background process by this:
$ sh foo &amp; sleep 5 &amp;&amp; kill $! &amp;&amp; fg
// Jadu,  unstableme.blogspot.com</description> <content:encoded><![CDATA[<p>Good one, I have to download and use it. Thanks.</p><p>The tip from Professor Fapsanders is also useful, we can make it more significant to kill the last background process by this:</p><p>$ sh foo &amp; sleep 5 &amp;&amp; kill $! &amp;&amp; fg</p><p>// Jadu,  unstableme.blogspot.com</p> ]]></content:encoded> </item> <item><title>By: Professor Fapsanders</title><link>http://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/#comment-38924</link> <dc:creator>Professor Fapsanders</dc:creator> <pubDate>Fri, 03 Oct 2008 17:37:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/faq/?p=1901#comment-38924</guid> <description>You can also do it with bash using sleep and job control:
$ foo &amp; sleep 10 &amp;&amp; kill %1 &amp;&amp; fg</description> <content:encoded><![CDATA[<p>You can also do it with bash using sleep and job control:<br
/> $ foo &amp; sleep 10 &amp;&amp; kill %1 &amp;&amp; fg</p> ]]></content:encoded> </item> </channel> </rss>
