<?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: shell sleep question. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385460#M865232</link>
    <description>Hi Brian,&lt;BR /&gt;&lt;BR /&gt;How are you executing the script?&lt;BR /&gt;&lt;BR /&gt;If all you do is run it as a background job (script &amp;amp;), when you log out your session, the script will receive a SIGHUP and terminate.&lt;BR /&gt;&lt;BR /&gt;To prevent this, there are several possibilities:-&lt;BR /&gt;1. Run it as a batch job (batch or at now)&lt;BR /&gt;2. Start it with nohup.&lt;BR /&gt;3. Include 'trap "" 1' in the script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
    <pubDate>Fri, 24 Sep 2004 04:21:34 GMT</pubDate>
    <dc:creator>John Palmer</dc:creator>
    <dc:date>2004-09-24T04:21:34Z</dc:date>
    <item>
      <title>shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385451#M865223</link>
      <description>Team:&lt;BR /&gt;&lt;BR /&gt;I have a very small shell program that does this: &lt;BR /&gt; &lt;BR /&gt; while `sleep 86400` &lt;BR /&gt; do &lt;BR /&gt; .. &lt;BR /&gt; .. &lt;BR /&gt; echo "Something" &lt;BR /&gt; ... &lt;BR /&gt; ... &lt;BR /&gt; done &lt;BR /&gt; &lt;BR /&gt; (86400 is one day).. The program does not seem to wake up after 1 day, and process what I want it to do everyday. &lt;BR /&gt; &lt;BR /&gt; If I change 86400 to some smaller number, it seems to work fine. Could anyone tell why something like this happens?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Brian.</description>
      <pubDate>Thu, 23 Sep 2004 12:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385451#M865223</guid>
      <dc:creator>brian_31</dc:creator>
      <dc:date>2004-09-23T12:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385452#M865224</link>
      <description>Your script as you want it should be :&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;...&lt;BR /&gt;echo "Something"&lt;BR /&gt;...&lt;BR /&gt;sleep 86400&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;But you may seriously consider using crontab.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Sep 2004 12:09:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385452#M865224</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-09-23T12:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385453#M865225</link>
      <description>Fred is right on. To explain why it is not working when you use 86400 with sleep.&lt;BR /&gt;&lt;BR /&gt;while `sleep 86400`&lt;BR /&gt;&lt;BR /&gt;while expects a condition that evaluates to "true" or "false".&lt;BR /&gt;&lt;BR /&gt;WHILE executes the sleep 86400 and waits for the completion.&lt;BR /&gt;&lt;BR /&gt;sleep command completes after one day and returns the exit code (should be 0) to while. Now WHILE will go ahead and execute the body.&lt;BR /&gt;&lt;BR /&gt;Clearly, this is not good scripting but I cannot think of a reason why this was not working for you.  It should have echoed "Something" after one day :-).&lt;BR /&gt;&lt;BR /&gt;Also understand, the above while loop is infinite. There is no exit condition. Not a very good scripting practise either.</description>
      <pubDate>Thu, 23 Sep 2004 13:23:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385453#M865225</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2004-09-23T13:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385454#M865226</link>
      <description>From the man page,&lt;BR /&gt;&lt;BR /&gt;sleep exits with one of the following values:&lt;BR /&gt;&lt;BR /&gt;0    The execution was successfully suspended for time seconds, or a SIGALRM signal was received.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;0   If the time operand is missing, is not a decimal integer, is negative, or is greater than UINT_MAX, sleep returns with exit status 2.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Sep 2004 13:29:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385454#M865226</guid>
      <dc:creator>John Kittel</dc:creator>
      <dc:date>2004-09-23T13:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385455#M865227</link>
      <description>so..could someone tell me why it works if i change to a lesser value?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Brian</description>
      <pubDate>Thu, 23 Sep 2004 13:58:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385455#M865227</guid>
      <dc:creator>brian_31</dc:creator>
      <dc:date>2004-09-23T13:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385456#M865228</link>
      <description>The man page says-&lt;BR /&gt; &lt;BR /&gt;If the time operand is missing, is not a decimal integer, is negative, or is greater than UINT_MAX, sleep returns with exit status 2.&lt;BR /&gt; &lt;BR /&gt;Could 86400 be greater than UINT_MAX?&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 23 Sep 2004 14:17:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385456#M865228</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-09-23T14:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385457#M865229</link>
      <description>Hi Rodney,&lt;BR /&gt;&lt;BR /&gt;According to /usr/include/limits.h UINT_MAX is either 4,294,967,295 ...or... 37,777,777,777 depending on how STDC is defined.&lt;BR /&gt;But these are values *IF* UINT_MAX is undefined.&lt;BR /&gt;I suspect that sleep may define it.&lt;BR /&gt;&lt;BR /&gt;At what value does the behavior begin - i.e. does it not happen at 86399? If so I'd suspect that UINT_MAX is indeed being set to 86400.&lt;BR /&gt;&lt;BR /&gt;My $0.02,&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 23 Sep 2004 14:29:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385457#M865229</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2004-09-23T14:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385458#M865230</link>
      <description>Could the process be terminated by another process that is running? Like a backup script that cleans unnecessay processes?&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 23 Sep 2004 14:30:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385458#M865230</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-09-23T14:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385459#M865231</link>
      <description>If  you are executing scripts liek this, it will be running on system on whole day. It is not efficient to do soem jobs there. Try to go to crontab to do easily and effectively there.&lt;BR /&gt;&lt;BR /&gt;# getconf UINT_MAX  ( 11.00) &lt;BR /&gt;4294967295&lt;BR /&gt;&lt;BR /&gt;It may not be the problem.&lt;BR /&gt;&lt;BR /&gt;Try to check script as,&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  sleep 86400&lt;BR /&gt;  if [[ $? -eq 2 ]]&lt;BR /&gt;  then&lt;BR /&gt;   echo "`date`problem with UINT_MAX `getconf UINT_MAX`"&lt;BR /&gt;  else&lt;BR /&gt;   echo "`date`Sleep returns $?"&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Redirect to another log file to analyse results later.  &lt;BR /&gt;</description>
      <pubDate>Thu, 23 Sep 2004 22:44:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385459#M865231</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-09-23T22:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385460#M865232</link>
      <description>Hi Brian,&lt;BR /&gt;&lt;BR /&gt;How are you executing the script?&lt;BR /&gt;&lt;BR /&gt;If all you do is run it as a background job (script &amp;amp;), when you log out your session, the script will receive a SIGHUP and terminate.&lt;BR /&gt;&lt;BR /&gt;To prevent this, there are several possibilities:-&lt;BR /&gt;1. Run it as a batch job (batch or at now)&lt;BR /&gt;2. Start it with nohup.&lt;BR /&gt;3. Include 'trap "" 1' in the script.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Fri, 24 Sep 2004 04:21:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385460#M865232</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2004-09-24T04:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: shell sleep question.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385461#M865233</link>
      <description>Brian,&lt;BR /&gt;&lt;BR /&gt;When you use while `sleep 86400`, you are first oputting it to sleep. So, there is no way you could see what is happening. Whereas, if you say sleep 180, you will notice it works after 3 minutes.</description>
      <pubDate>Wed, 29 Sep 2004 20:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-sleep-question/m-p/3385461#M865233</guid>
      <dc:creator>Chang_6</dc:creator>
      <dc:date>2004-09-29T20:21:20Z</dc:date>
    </item>
  </channel>
</rss>

