<?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 is not working, need your help. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969037#M417418</link>
    <description>Thanks everybody.&lt;BR /&gt;&lt;BR /&gt;Gulam.</description>
    <pubDate>Thu, 23 Mar 2006 09:22:41 GMT</pubDate>
    <dc:creator>Gulam Mohiuddin</dc:creator>
    <dc:date>2006-03-23T09:22:41Z</dc:date>
    <item>
      <title>Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969030#M417411</link>
      <description>This script is not working as expected; I should get an email if the error appears in the log.&lt;BR /&gt;&lt;BR /&gt;The script runs every minute through CRON from 1 to 5 am.&lt;BR /&gt;&lt;BR /&gt;The script works fine if I manually assign values for HRMM=01:00 variable, but will not work with runtime values.&lt;BR /&gt;&lt;BR /&gt;The script returns a â  0â   value even error exists.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;LOGS=/psoft/hr88/appserv/RPHRMS/LOGS&lt;BR /&gt;HRMM=`date +%H:%M`&lt;BR /&gt;#HRMM=01:00&lt;BR /&gt;logdate=`date +%m%d`&lt;BR /&gt;mytime=0&lt;BR /&gt;&lt;BR /&gt;mytime=`awk '/java.net.ConnectException/ &amp;amp;&amp;amp; (substr($3,1,5)  == "'"$HRMM"'") {n++}; END {print n+0}' $LOGS/APPSRV_${logdate}.LOG`&lt;BR /&gt;&lt;BR /&gt;if [[ $mytime -ne  0 ]]; then&lt;BR /&gt;echo "WebServer is down"| mailx -s "WebServer Down $(date +%Y%m%d' '%H:%M)" gulam@peelsoft.ca&lt;BR /&gt;fi&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Gulam.&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2006 10:03:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969030#M417411</guid>
      <dc:creator>Gulam Mohiuddin</dc:creator>
      <dc:date>2006-03-22T10:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969031#M417412</link>
      <description>I think the problem is in the way you are trying to use $HRMM in the awk command.&lt;BR /&gt; &lt;BR /&gt;awk has an option -v to set a variable outside of the script so it can be used in the script.&lt;BR /&gt; &lt;BR /&gt;You might try the following-&lt;BR /&gt;mytime=`awk -v HRMM=$HRMM '/java.net.ConnectException/ &amp;amp;&amp;amp; (substr($3,1,5) == HRMM) {n++}; END {print n+0}' $LOGS/APPSRV_${logdate}.LOG`&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2006 13:44:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969031#M417412</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2006-03-22T13:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969032#M417413</link>
      <description>Replace this:&lt;BR /&gt;&lt;BR /&gt;mytime=`awk '/java.net.ConnectException/ &amp;amp;&amp;amp; (substr($3,1,5) == "'"$HRMM"'") {n++}; END {print n+0}' $LOGS/APPSRV_${logdate}.LOG`&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;with this:&lt;BR /&gt;&lt;BR /&gt;echo "HRMM " $HRMM &amp;gt; tmpfile&lt;BR /&gt;cat $LOGS/APPSRV_${logdate}.LOG &amp;gt;&amp;gt; tmpfile&lt;BR /&gt;awk '/HRMM/{myhrmm=$2;};/java.net.ConnectException/{if (substr($3,1,5) == myhrmm) {n++}; END {print n+0}'  &amp;lt; tmpfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Mar 2006 13:53:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969032#M417413</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2006-03-22T13:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969033#M417414</link>
      <description>Hi Gulam,&lt;BR /&gt;please add set -x at the topo of the script and post the output.&lt;BR /&gt;I don't think that the problem was the way you are using HRMM, because awk get it fine in both way:&lt;BR /&gt;&lt;BR /&gt;/tmp/&amp;gt;HRMM=01:00&lt;BR /&gt;/tmp/&amp;gt;awk 'BEGIN {print "'"$HRMM"'"}' 01:00&lt;BR /&gt;&lt;BR /&gt;/tmp/&amp;gt;   HRMM=`date +%H:%M`&lt;BR /&gt;/tmp/&amp;gt;awk 'BEGIN {print "'"$HRMM"'"}' 04:12&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 23 Mar 2006 04:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969033#M417414</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-03-23T04:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969034#M417415</link>
      <description>Script is fine. May be you can enable debugging in the script with set -x or set -v. what are you getting in that. I hope no data is available for that time frame.&lt;BR /&gt;&lt;BR /&gt;Or change this line in script and try. Are you getting that mail atleast?&lt;BR /&gt;&lt;BR /&gt;if [[ $mytime -ne 0 ]]; then&lt;BR /&gt;echo "WebServer is down"| mailx -s "WebServer Down $(date +%Y%m%d' '%H:%M)" gulam@peelsoft.ca&lt;BR /&gt;else&lt;BR /&gt;echo "WebServer is running fine" | mailx -s "WebServer  is running fine $(date +%Y%m%d' '%H:%M)" gulam@peelsoft.ca&lt;BR /&gt;fi&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Thu, 23 Mar 2006 04:39:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969034#M417415</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-23T04:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969035#M417416</link>
      <description>BTW,&lt;BR /&gt;&lt;BR /&gt;HRMM=01:00&lt;BR /&gt;&lt;BR /&gt;will not send mails b'cas no data availale in the log file to provide that. Try to change it as,&lt;BR /&gt;&lt;BR /&gt;HRMM=01:12&lt;BR /&gt;&lt;BR /&gt;will send mails. &lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Thu, 23 Mar 2006 04:48:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969035#M417416</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-03-23T04:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969036#M417417</link>
      <description>Thanks everybody, this script is working now.&lt;BR /&gt;&lt;BR /&gt;When I traced it with -x, I found that there was 1 minute difference between log messages and cron/system time. I changed my checking time one minute behind (-1) and everything starting working as expected.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Gulam.</description>
      <pubDate>Thu, 23 Mar 2006 09:22:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969036#M417417</guid>
      <dc:creator>Gulam Mohiuddin</dc:creator>
      <dc:date>2006-03-23T09:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script is not working, need your help.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969037#M417418</link>
      <description>Thanks everybody.&lt;BR /&gt;&lt;BR /&gt;Gulam.</description>
      <pubDate>Thu, 23 Mar 2006 09:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-is-not-working-need-your-help/m-p/4969037#M417418</guid>
      <dc:creator>Gulam Mohiuddin</dc:creator>
      <dc:date>2006-03-23T09:22:41Z</dc:date>
    </item>
  </channel>
</rss>

