<?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 Quick Script Question: Waiting for a (period) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654628#M46899</link>
    <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I need a method of setting a pause from within a script, other than sleep. I want to be able to wait for a random amount of time betweet 0 and 1 sec.&lt;BR /&gt;&lt;BR /&gt;Does anyone have a reliable non hardware dependant solution ?&lt;BR /&gt;&lt;BR /&gt;All tips, pointers, RTFF's , RTFM's warmly received as ever !!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;-ChaZ-</description>
    <pubDate>Tue, 29 Jan 2002 13:18:15 GMT</pubDate>
    <dc:creator>Charles Harris</dc:creator>
    <dc:date>2002-01-29T13:18:15Z</dc:date>
    <item>
      <title>Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654628#M46899</link>
      <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I need a method of setting a pause from within a script, other than sleep. I want to be able to wait for a random amount of time betweet 0 and 1 sec.&lt;BR /&gt;&lt;BR /&gt;Does anyone have a reliable non hardware dependant solution ?&lt;BR /&gt;&lt;BR /&gt;All tips, pointers, RTFF's , RTFM's warmly received as ever !!&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;-ChaZ-</description>
      <pubDate>Tue, 29 Jan 2002 13:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654628#M46899</guid>
      <dc:creator>Charles Harris</dc:creator>
      <dc:date>2002-01-29T13:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654629#M46900</link>
      <description>You could use perl to randomly come up with a value between 0 and 1, then multiply that by some factor, say 100 (or maybe the mhz of the processor), then perform some large calculation in a loop.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 29 Jan 2002 13:25:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654629#M46900</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-01-29T13:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654630#M46901</link>
      <description>Hi Charles,&lt;BR /&gt;&lt;BR /&gt;With perl:&lt;BR /&gt;&lt;BR /&gt;perl -e "select(undef,undef,undef,\$ARGV[0]);" n&lt;BR /&gt;&lt;BR /&gt;will work for fractional values of n.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Tue, 29 Jan 2002 13:29:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654630#M46901</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-29T13:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654631#M46902</link>
      <description>Hi there.&lt;BR /&gt;Look at script and check, whether you can use it :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;today_=`date +'%y-%m-%d'`; export today_&lt;BR /&gt;#&lt;BR /&gt;LOG1=/usr/tmp/cpio_${today_}.1st; export LOG1&lt;BR /&gt;#&lt;BR /&gt;PATH=$PATH:/usr/local/bin&lt;BR /&gt;export PATH&lt;BR /&gt;exec &amp;gt; /usr/tmp/cpio_${today_}.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;#&lt;BR /&gt;   #&lt;BR /&gt;   find     /                       -depth -print | cpio -ocBv &amp;gt; /dev/rmt/0m   2&amp;gt;&amp;gt; ${LOG1} &amp;amp;&lt;BR /&gt;   first_cpio=$!; export first_cpio&lt;BR /&gt;    #&lt;BR /&gt;    wait $first_cpio&lt;BR /&gt;&lt;BR /&gt;    if test $? -ne 0; then&lt;BR /&gt;     echo "Full Offline Backup did not complete successfully!"&lt;BR /&gt;    fi&lt;BR /&gt;   echo "Time is: `/bin/date`"&lt;BR /&gt;   echo "Time is: `/bin/date`"&lt;BR /&gt;   echo "Time is: `/bin/date`" &amp;gt;&amp;gt; ${LOG1}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--------------------&lt;BR /&gt;Rgds&lt;BR /&gt;Alexander M. Ermes</description>
      <pubDate>Tue, 29 Jan 2002 13:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654631#M46902</guid>
      <dc:creator>Alexander M. Ermes</dc:creator>
      <dc:date>2002-01-29T13:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654632#M46903</link>
      <description>Hi Charles,&lt;BR /&gt;&lt;BR /&gt;Might help if I read the question - this will give you a random sleep between 0 and 1 secs:&lt;BR /&gt;&lt;BR /&gt;perl -e "srand;select(undef,undef,undef,rand);"&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Tue, 29 Jan 2002 13:33:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654632#M46903</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-29T13:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654633#M46904</link>
      <description>Thanks for the tips everyone, I know Perl would be an obvious choice, but I'm stuck with the good old shell.&lt;BR /&gt;&lt;BR /&gt;I really need something available from the shell even if it's not very accurate. I've tried loops etc, but I don't really want to write code that hammers the server into making a delay.&lt;BR /&gt;&lt;BR /&gt;Any other thoughts ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;-ChaZ-</description>
      <pubDate>Tue, 29 Jan 2002 13:37:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654633#M46904</guid>
      <dc:creator>Charles Harris</dc:creator>
      <dc:date>2002-01-29T13:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654634#M46905</link>
      <description>Why do you need to wait for 0 - 1 second? If 1 second is OK why not sleep 1?&lt;BR /&gt;&lt;BR /&gt;I guess you could just ran a command that doesn't do anything except take up time.&lt;BR /&gt;something like&lt;BR /&gt;&lt;BR /&gt;echo "do nothing" &amp;gt; /dev/null</description>
      <pubDate>Tue, 29 Jan 2002 14:07:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654634#M46905</guid>
      <dc:creator>Krishna Prasad</dc:creator>
      <dc:date>2002-01-29T14:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654635#M46906</link>
      <description>Belive it or not I want the delay to a realism to the following code. PLEASE NOTE it is not being used for deception, only to (nicely) illustrate the practical (or not very) use of arrays.&lt;BR /&gt;&lt;BR /&gt;snip:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh                                      &lt;BR /&gt;# scroll                                           &lt;BR /&gt;# Don't ask.                                       &lt;BR /&gt;                                                   &lt;BR /&gt;typeset -i x=0                                     &lt;BR /&gt;strg_len=$(echo "$*" | wc -m)                      &lt;BR /&gt;clear                                              &lt;BR /&gt;                                                   &lt;BR /&gt;while (( x &amp;lt; $strg_len )) &amp;amp;&amp;amp; (( $strg_len &amp;lt; 1024 ))&lt;BR /&gt;do                                                 &lt;BR /&gt;        (( x = x + 1 ))                            &lt;BR /&gt;        scroll[x]=`echo "$*" |cut -c $x`           &lt;BR /&gt;        print "${scroll[x]}\c"                     &lt;BR /&gt;        sleep 1                                    &lt;BR /&gt;done                                               &lt;BR /&gt;tput cud1                                          &lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-ChaZ-&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2002 14:17:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654635#M46906</guid>
      <dc:creator>Charles Harris</dc:creator>
      <dc:date>2002-01-29T14:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654636#M46907</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You have a fundamental problem in that sleep has second resolution. However, there is a system call, nanosleep, which has much finer resolution. You could write a very small C program which nanosleeps for an amount of time based upon the random parameter passed in by the calling process - your shell script. The entire C program would be at most 20 lines of code.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2002 14:22:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654636#M46907</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-29T14:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654637#M46908</link>
      <description>Thanks again for the tips, by the look's of it I'm going to have to try my hand at C&lt;BR /&gt;Could someone point me in the right direction?&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-ChaZ-&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2002 14:43:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654637#M46908</guid>
      <dc:creator>Charles Harris</dc:creator>
      <dc:date>2002-01-29T14:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654638#M46909</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;write this little c program:&lt;BR /&gt;&lt;BR /&gt;main(argc, argv)&lt;BR /&gt;int argc;&lt;BR /&gt;char **argv;&lt;BR /&gt;{&lt;BR /&gt;usleep(atoi(argv[1]));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Compile ie:&lt;BR /&gt;cc usleep.c -o usleep&lt;BR /&gt;&lt;BR /&gt;Run it ie:&lt;BR /&gt;usleep 100&lt;BR /&gt;&lt;BR /&gt;will wait 10 micro seconds before continue.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 29 Jan 2002 14:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654638#M46909</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2002-01-29T14:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654639#M46910</link>
      <description>Hi Charles:&lt;BR /&gt;&lt;BR /&gt;Here is my 2 minute C program. Use it like this: nanosleep 4500 to cause a 4500 msec delay or nanosleep 750 to cause a 750msec delay.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Tue, 29 Jan 2002 15:00:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654639#M46910</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-01-29T15:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654640#M46911</link>
      <description>Hi Charles,&lt;BR /&gt;&lt;BR /&gt;Here's one that gives you random tenths of a second delays:&lt;BR /&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;#include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  int m;&lt;BR /&gt;  srand((unsigned long)time(NULL));&lt;BR /&gt;  m = 100000*(int) (10.0*rand()/(RAND_MAX+1.0));&lt;BR /&gt;/*  printf("%d\n",m); */&lt;BR /&gt;  usleep(m);&lt;BR /&gt;&lt;BR /&gt;  return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.&lt;/STDLIB.H&gt;&lt;/UNISTD.H&gt;</description>
      <pubDate>Tue, 29 Jan 2002 15:27:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654640#M46911</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-01-29T15:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Quick Script Question: Waiting for a (period)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654641#M46912</link>
      <description>Thanks to everyone who helped out with this, the C code has been particularly useful ! &lt;BR /&gt;&lt;BR /&gt;I'll get compiling later today and make sure everything's okay.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;&lt;BR /&gt;-ChaZ-&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 30 Jan 2002 09:36:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quick-script-question-waiting-for-a-period/m-p/2654641#M46912</guid>
      <dc:creator>Charles Harris</dc:creator>
      <dc:date>2002-01-30T09:36:27Z</dc:date>
    </item>
  </channel>
</rss>

