<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script timeout parameters in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553238#M917811</link>
    <description>Hi Darrian,&lt;BR /&gt;&lt;BR /&gt;No the command while block all year until completed. Even's James' suggestion of test with kill -0 pid is not foolproof because on these time scales pid's are recycled.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In your case you could simply do this:&lt;BR /&gt;&lt;BR /&gt;cmd1 &amp;amp;&lt;BR /&gt;cmd2 &amp;amp;&lt;BR /&gt;cmd3 &amp;amp;&lt;BR /&gt;cmd4 &amp;amp;&lt;BR /&gt;cmd5 &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;This will start all of the commands in background but the script will not exit until&lt;BR /&gt;all the background processes complete.&lt;BR /&gt;&lt;BR /&gt;If cmd2 must wait until cmd1 completes but the others can run asynchrously, you could do this:&lt;BR /&gt;&lt;BR /&gt;(cmd1; cmd2) &amp;amp;&lt;BR /&gt;cmd3 &amp;amp;&lt;BR /&gt;cmd4 &amp;amp;&lt;BR /&gt;cmd5 &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;If you want really good timeout (alarm) and other signal handlers from a scripting language probably your best bet is perl.&lt;BR /&gt;&lt;BR /&gt;My 2 cents, Clay&lt;BR /&gt;</description>
    <pubDate>Mon, 16 Jul 2001 17:08:45 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2001-07-16T17:08:45Z</dc:date>
    <item>
      <title>script timeout parameters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553235#M917808</link>
      <description>Do scripts generally timeout after some predetermined period of time? If so, is this 'timeout' parameter adjustable?  I wrote a script consisting of 5 tasks: if one task takes ALL DAY to complete will the script wait ALL DAY for the process or will it move to the next process after X number of minutes?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jul 2001 16:29:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553235#M917808</guid>
      <dc:creator>Mark Mischler</dc:creator>
      <dc:date>2001-07-16T16:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: script timeout parameters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553236#M917809</link>
      <description>Hi Darrian,&lt;BR /&gt;It is depends on your script.&lt;BR /&gt;for example if you doing remsh from your script it will generally timeout after couple second. &lt;BR /&gt;You have to put checking in you script for example that frist you want to display date only 10 times then do task 2 if task 2 fails or if result from task 2 is none after 5 minute then report the error and go on for task 3 or exit from script.&lt;BR /&gt;&lt;BR /&gt;Sachin&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jul 2001 16:37:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553236#M917809</guid>
      <dc:creator>Sachin Patel</dc:creator>
      <dc:date>2001-07-16T16:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: script timeout parameters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553237#M917810</link>
      <description>Hi Darrian:&lt;BR /&gt;&lt;BR /&gt;There are various ways to do what you want.&lt;BR /&gt;&lt;BR /&gt;You can create background processes, monitor them and kill them after a predetermined time if they have not completed.  The monitoring can be done using the PID of the background process and a 'kill -0' to test if its still a valid PID.&lt;BR /&gt;&lt;BR /&gt;If you are reading input from 'stdin', the 'line' command has a timeout feature.  The command reads one line (up to a newline) from stdin.  If nothing is read after (t)imeout then a null string is returned:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;echo "...reading..."&lt;BR /&gt;WHAT=`line -t 5` #...give user 5-seconds to respond&lt;BR /&gt;if [ ! -z "$WHAT" ]&lt;BR /&gt;then&lt;BR /&gt;  echo "I read: $WHAT"&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;#.end.&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jul 2001 16:55:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553237#M917810</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-16T16:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: script timeout parameters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553238#M917811</link>
      <description>Hi Darrian,&lt;BR /&gt;&lt;BR /&gt;No the command while block all year until completed. Even's James' suggestion of test with kill -0 pid is not foolproof because on these time scales pid's are recycled.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In your case you could simply do this:&lt;BR /&gt;&lt;BR /&gt;cmd1 &amp;amp;&lt;BR /&gt;cmd2 &amp;amp;&lt;BR /&gt;cmd3 &amp;amp;&lt;BR /&gt;cmd4 &amp;amp;&lt;BR /&gt;cmd5 &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;This will start all of the commands in background but the script will not exit until&lt;BR /&gt;all the background processes complete.&lt;BR /&gt;&lt;BR /&gt;If cmd2 must wait until cmd1 completes but the others can run asynchrously, you could do this:&lt;BR /&gt;&lt;BR /&gt;(cmd1; cmd2) &amp;amp;&lt;BR /&gt;cmd3 &amp;amp;&lt;BR /&gt;cmd4 &amp;amp;&lt;BR /&gt;cmd5 &amp;amp;&lt;BR /&gt;wait&lt;BR /&gt;&lt;BR /&gt;If you want really good timeout (alarm) and other signal handlers from a scripting language probably your best bet is perl.&lt;BR /&gt;&lt;BR /&gt;My 2 cents, Clay&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Jul 2001 17:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553238#M917811</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-07-16T17:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: script timeout parameters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553239#M917812</link>
      <description>Hi Darrian:&lt;BR /&gt;&lt;BR /&gt;I agree with Clay that one would not want to let long periods of time elapse and then arbitrarily test the vailidity of a PID.&lt;BR /&gt;&lt;BR /&gt;What I meant was a case where you initiate your process in the background; capture its PID using the "$!" variable; and in a loop sleep for a short time (in seconds); waken; test the captured PID; continue if done; or return to the loop until done.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 16 Jul 2001 17:21:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-timeout-parameters/m-p/2553239#M917812</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-07-16T17:21:30Z</dc:date>
    </item>
  </channel>
</rss>

