<?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: Time parameter in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075982#M809451</link>
    <description>I got it. Thanks for all your time and help.</description>
    <pubDate>Mon, 22 Sep 2003 11:05:15 GMT</pubDate>
    <dc:creator>Ragni Singh</dc:creator>
    <dc:date>2003-09-22T11:05:15Z</dc:date>
    <item>
      <title>Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075972#M809431</link>
      <description>Hey guys, I need some help here. How can I add a time parameter in a script that does the following. I'd like for the script to check if the time is 5:05, it will execute the script and return a 0 code and the end time of 1:15 pm. &lt;BR /&gt;&lt;BR /&gt;I hope you understand what I'm asking for. Any help is greatly appreciated and points will be assigned.</description>
      <pubDate>Mon, 22 Sep 2003 09:29:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075972#M809431</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2003-09-22T09:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075973#M809432</link>
      <description>Do a man on "cron" and "crontab" adding an entry for &lt;BR /&gt;&lt;BR /&gt;05 05 * * * /scriptpath/scriptname&lt;BR /&gt;&lt;BR /&gt;then one for 1:15pm&lt;BR /&gt;&lt;BR /&gt;15 13 * * * /scriptpath/scriptname&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 22 Sep 2003 09:33:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075973#M809432</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2003-09-22T09:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075974#M809434</link>
      <description>Thanks for your response but here is the whole issue. YOu see we have a scheduled template that monitors some processes that run from 5:05 till 1315 only. In openview template, you can't specify from 05-1315. You can give it like 0-59 for minutes and then 1-24 for hours. If I specify 5-59, that would mean that the first 5 minutes of every hour be skipped. I hope I haven't confused you so far. Thats when I thought I could just add a time check that checks for something like such... if 5:05 run script, if time is past 1315, stop script. I think I can try adding this in cron and see how that works out. Thanks.</description>
      <pubDate>Mon, 22 Sep 2003 09:46:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075974#M809434</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2003-09-22T09:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075975#M809436</link>
      <description>Here's one way:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;calc_time() # converts hrs and mins to minutes since midnite&lt;BR /&gt;{&lt;BR /&gt;  typeset -i10 HR=${1}&lt;BR /&gt;  typeset -i10 MIN=${2}&lt;BR /&gt;  shift 2&lt;BR /&gt;  typeset -i10 TM=$(( (${HR} * 60) + ${MIN} ))&lt;BR /&gt;  echo "${TM}"&lt;BR /&gt;  return 0&lt;BR /&gt;} # calc_time&lt;BR /&gt;&lt;BR /&gt;START=$(calc_time 5 5)&lt;BR /&gt;END=$(calc_time 13 15)&lt;BR /&gt;NOW=$(calc_time $(date '+%H %M'))&lt;BR /&gt;if [[ ${NOW} -ge ${START} &amp;amp;&amp;amp; ${NOW} -le ${END} ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Do your stuff; your commands go here".&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 10:15:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075975#M809436</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-22T10:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075976#M809438</link>
      <description>Thanks for your help Clay but could you please explain to me what those 3 typeset paramters are?</description>
      <pubDate>Mon, 22 Sep 2003 10:35:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075976#M809438</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2003-09-22T10:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075977#M809440</link>
      <description>Typesets are the shell's way of 'typing' variables. You can leave the typesets out and the script will still work but it is considered good coding practice to always typeset shell variables. &lt;BR /&gt; &lt;BR /&gt;typeset -i10 XX=30 declares XX to be a base 10 integer variable. Integer typesets become very important in some shells when leading zeroes may occur. &lt;BR /&gt; &lt;BR /&gt;Man sh-posix for details.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 10:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075977#M809440</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-22T10:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075978#M809442</link>
      <description>Here goes my script. It complains about some syntax error and I believe it has to do with the if, do statments. Can anyone point out to me what its complaining about. &lt;BR /&gt;&lt;BR /&gt;1  #!/usr/bin/ksh&lt;BR /&gt;     2&lt;BR /&gt;     3  OPCMSG=/opt/OV/bin/OpC/opcmsg&lt;BR /&gt;     4  PROC[1]="processManager"&lt;BR /&gt;     5  PROC[2]="fbam"&lt;BR /&gt;     6  PROC[3]="pcxsml"&lt;BR /&gt;     7  PROC[4]="fbdm"&lt;BR /&gt;     8  PROC[5]="fbpoetio"&lt;BR /&gt;     9  PROC[6]="fbneonio"&lt;BR /&gt;    10  PROC[7]="pcxrm"&lt;BR /&gt;    11  PROC[8]="fbmoc"&lt;BR /&gt;    12  PROC[9]="fbdbx"&lt;BR /&gt;    13&lt;BR /&gt;    14  calc_time() # converts hrs and mins since midnite&lt;BR /&gt;    15  {&lt;BR /&gt;    16  typeset -i10 HR=${1}&lt;BR /&gt;    17  typeset -i10 MIN=${2}&lt;BR /&gt;    18  shift 2&lt;BR /&gt;    19  typeset -i10 TM=$(( (${HR}*60) + ${MIN} ))&lt;BR /&gt;    20  echo "${TM}"&lt;BR /&gt;    21  return 0&lt;BR /&gt;    22  } # calc_time&lt;BR /&gt;    23  START=$(calc_time 5 5)&lt;BR /&gt;    24  END=$(calc_time 13 15)&lt;BR /&gt;    25  NOW=$(calc_time $(date '+%H %M'))&lt;BR /&gt;    26  if [[ ${NOW} -ge ${START} &amp;amp;&amp;amp; ${NOW} -le ${END} ]]&lt;BR /&gt;    27  then&lt;BR /&gt;    28  ps -ef | grep -v grep | egrep '(processManager|fb[ad]m|pcxsml|fb.*io|pcx&lt;BR /&gt;rm|fbmoc|fbdbx)' | awk '{ print $8 }' | sed 's/\/..*\///g' &amp;gt; /var/tmp/fbhh_proc&lt;BR /&gt;    29&lt;BR /&gt;    30  for i in 1 2 3 4 5 6 7 8 9&lt;BR /&gt;    31  do&lt;BR /&gt;    32&lt;BR /&gt;    33  grep -q ${PROC[i]} /var/tmp/fbhh_proc&lt;BR /&gt;    34  if [ $? -ne 0 ]&lt;BR /&gt;    35  then&lt;BR /&gt;    36  ${OPCMSG} appl=FBHH s=critical msg_g=FBHH object=process \&lt;BR /&gt;    37  msg_t="PROCESS ${PROC[i]} IS NOT WORKING!!!"&lt;BR /&gt;    38  fi&lt;BR /&gt;    39&lt;BR /&gt;    40  done&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 10:47:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075978#M809442</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2003-09-22T10:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075979#M809445</link>
      <description>You are missing 'fi' statement for 'if' in line 27.</description>
      <pubDate>Mon, 22 Sep 2003 10:51:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075979#M809445</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2003-09-22T10:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075980#M809447</link>
      <description>Here is one obvious error:&lt;BR /&gt; &lt;BR /&gt;grep -q ${PROC[i]} /var/tmp/fbhh_proc&lt;BR /&gt;&lt;BR /&gt;should be &lt;BR /&gt; &lt;BR /&gt;grep -q ${PROC[${i}]} /var/tmp/fbhh_proc&lt;BR /&gt;&lt;BR /&gt;I also never saw where PROC was ever assigned a value.&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Sep 2003 10:59:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075980#M809447</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-09-22T10:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075981#M809449</link>
      <description>Correction: 'if' is in line 26, missing 'fi' should be in line 29.</description>
      <pubDate>Mon, 22 Sep 2003 11:03:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075981#M809449</guid>
      <dc:creator>Vitek Pepas</dc:creator>
      <dc:date>2003-09-22T11:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Time parameter in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075982#M809451</link>
      <description>I got it. Thanks for all your time and help.</description>
      <pubDate>Mon, 22 Sep 2003 11:05:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/time-parameter-in-a-script/m-p/3075982#M809451</guid>
      <dc:creator>Ragni Singh</dc:creator>
      <dc:date>2003-09-22T11:05:15Z</dc:date>
    </item>
  </channel>
</rss>

