<?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: perl localtime help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006325#M47857</link>
    <description>Alexander,&lt;BR /&gt;&lt;BR /&gt;What I'm looking for/ want to do is.&lt;BR /&gt;&lt;BR /&gt;if day=day &amp;amp;&amp;amp; hr = hr &amp;amp;&amp;amp; min = min&lt;BR /&gt;&lt;BR /&gt;system("do something")&lt;BR /&gt;        else&lt;BR /&gt;             do nothing&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;output above&lt;BR /&gt;   start hr =09  current hr =09  &lt;BR /&gt;   current mn = 23    start min = 30&lt;BR /&gt;&lt;BR /&gt;output: working should only print &lt;BR /&gt;  if (start hr)09 = 09 &amp;amp;&amp;amp; mn =&amp;gt;(start mn)30&lt;BR /&gt;23 is not = or &amp;gt; than 30</description>
    <pubDate>Mon, 02 Oct 2006 08:56:06 GMT</pubDate>
    <dc:creator>J. Callender</dc:creator>
    <dc:date>2006-10-02T08:56:06Z</dc:date>
    <item>
      <title>perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006323#M47855</link>
      <description>All,&lt;BR /&gt;&lt;BR /&gt;Please advise what I'm doing wrong.  Following is my script.  I want to stop process if&lt;BR /&gt;day = day &amp;amp;&amp;amp;  start hour = hour &amp;amp;&amp;amp; min =&amp;gt; start min&lt;BR /&gt;&lt;BR /&gt;The following is not working.&lt;BR /&gt;&lt;BR /&gt;#!/opt/OV/nonOV/perl/a/bin/perl&lt;BR /&gt;#&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;my @Array = localtime(time );&lt;BR /&gt;my $yy    = sprintf("%4.2d", $Array[5] + 1900);&lt;BR /&gt;my $dd    = sprintf("%2.2d",$Array[3]);&lt;BR /&gt;my $mm    = sprintf("%2.2d",$Array[4] + 1);&lt;BR /&gt;&lt;BR /&gt;my $hr    = sprintf("%2.2d",$Array[2]);&lt;BR /&gt;my $mn    = sprintf("%2.2d",$Array[1]);&lt;BR /&gt;my $sec   = sprintf("%2.2d",$Array[0]);&lt;BR /&gt;&lt;BR /&gt;my $wday = (localtime(time))[6];&lt;BR /&gt;my $day_of_week = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')[$wday];&lt;BR /&gt;&lt;BR /&gt;my $start_hr  = "09";&lt;BR /&gt;my $start_min = "30";&lt;BR /&gt;&lt;BR /&gt;if (($wday == 1) &amp;amp;&amp;amp; ($hr == $start_hr) &amp;amp;&amp;amp; ($mn =&amp;gt; $start_min))   {&lt;BR /&gt;      print "Working..   $start_hr = $hr  $mn =&amp;gt; $start_min\n";&lt;BR /&gt;        } else {&lt;BR /&gt;           print "Not Working..\n";&lt;BR /&gt;               }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;&lt;BR /&gt;juniorc-&amp;gt;./test_hr_mn.pl&lt;BR /&gt;Working..   09 = 09  23 =&amp;gt; 30&lt;BR /&gt;&lt;BR /&gt;Appreciate all help.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Oct 2006 08:24:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006323#M47855</guid>
      <dc:creator>J. Callender</dc:creator>
      <dc:date>2006-10-02T08:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006324#M47856</link>
      <description>What would you like it to print?</description>
      <pubDate>Mon, 02 Oct 2006 08:46:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006324#M47856</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2006-10-02T08:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006325#M47857</link>
      <description>Alexander,&lt;BR /&gt;&lt;BR /&gt;What I'm looking for/ want to do is.&lt;BR /&gt;&lt;BR /&gt;if day=day &amp;amp;&amp;amp; hr = hr &amp;amp;&amp;amp; min = min&lt;BR /&gt;&lt;BR /&gt;system("do something")&lt;BR /&gt;        else&lt;BR /&gt;             do nothing&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;output above&lt;BR /&gt;   start hr =09  current hr =09  &lt;BR /&gt;   current mn = 23    start min = 30&lt;BR /&gt;&lt;BR /&gt;output: working should only print &lt;BR /&gt;  if (start hr)09 = 09 &amp;amp;&amp;amp; mn =&amp;gt;(start mn)30&lt;BR /&gt;23 is not = or &amp;gt; than 30</description>
      <pubDate>Mon, 02 Oct 2006 08:56:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006325#M47857</guid>
      <dc:creator>J. Callender</dc:creator>
      <dc:date>2006-10-02T08:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006326#M47858</link>
      <description>I mean it works (as long as you try it on Monday after 9 am and before 10 am.&lt;BR /&gt;&lt;BR /&gt;One more condition:&lt;BR /&gt;your perl really is at that path:&lt;BR /&gt;#!/opt/OV/nonOV/perl/a/bin/perl&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Oct 2006 08:57:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006326#M47858</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2006-10-02T08:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006327#M47859</link>
      <description>I tried your code on my machine and it works just fine ( I mean it prints working only during specified time).&lt;BR /&gt;&lt;BR /&gt;One little suggestion, that will probably make your program shorter.&lt;BR /&gt;I see no reason to use sprintf here-correct me if I'm wrong.&lt;BR /&gt;you could take all variables in one line:&lt;BR /&gt;&lt;BR /&gt;my ($sec,$mn,$hr,$dd,$mm,$yy,$wday)=localtime;&lt;BR /&gt;correct the month and the year:&lt;BR /&gt;$mm+=1;&lt;BR /&gt;$yy+=1900;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Oct 2006 09:11:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006327#M47859</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2006-10-02T09:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006328#M47860</link>
      <description>I work if day = Mon, Tue, Wed, etc...&lt;BR /&gt;and hr = 09&lt;BR /&gt;&lt;BR /&gt;I want it to do something if day = Mon, Tue etc...  and hr =09  and min =&amp;gt; 30, 40, etc.&lt;BR /&gt;&lt;BR /&gt;I run the script every 15 min.&lt;BR /&gt;&lt;BR /&gt;Yes perl in #!/opt/OV/nonOV/perl/a/bin/perl&lt;BR /&gt;&lt;BR /&gt;This server have OpenView installed, and that where OpenView install perl.</description>
      <pubDate>Mon, 02 Oct 2006 09:11:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006328#M47860</guid>
      <dc:creator>J. Callender</dc:creator>
      <dc:date>2006-10-02T09:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006329#M47861</link>
      <description>I suggest you to double check the week day of execution, because it works just fine on my system...&lt;BR /&gt;When it's Monday - it works.&lt;BR /&gt;all other days it prints : not working.</description>
      <pubDate>Mon, 02 Oct 2006 09:16:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006329#M47861</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2006-10-02T09:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006330#M47862</link>
      <description>It could be the version of Perl that you use-try to replace the first line with perl that comes with installation and see if it works the way you expect.&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Oct 2006 10:21:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006330#M47862</guid>
      <dc:creator>Alexander Chuzhoy</dc:creator>
      <dc:date>2006-10-02T10:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: perl localtime help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006331#M47863</link>
      <description>Thread Closed</description>
      <pubDate>Mon, 02 Oct 2006 12:23:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-localtime-help/m-p/5006331#M47863</guid>
      <dc:creator>J. Callender</dc:creator>
      <dc:date>2006-10-02T12:23:21Z</dc:date>
    </item>
  </channel>
</rss>

