<?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 script to email about nslookup failure in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645848#M676744</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: But Tharshini said: This is the script: #!/bin/sh&lt;BR /&gt;&lt;BR /&gt;And I saw that as I noted, but I'm not convinced (and asked specifically) if this was HP-UX and what version thereof.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Fri, 11 Jun 2010 12:24:30 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2010-06-11T12:24:30Z</dc:date>
    <item>
      <title>Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645838#M676733</link>
      <description>I'm currently writing a shell script to do nslookup on a list of servers which could be obtained from listener file. Could anyone please help me how to send an email notification in case nslookup failed for a server?</description>
      <pubDate>Thu, 10 Jun 2010 13:01:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645838#M676733</guid>
      <dc:creator>Tharshini</dc:creator>
      <dc:date>2010-06-10T13:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645839#M676734</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;cat ./nsfailure&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;HOST=$1&lt;BR /&gt;RSLT=$(nslookup $1 | sed -ne "/can.t find/p")&lt;BR /&gt;[ -z "${RSLT}" ] || mailx -s "nslookup failed: ${RSLT}" root &amp;lt; /dev/null&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;# ./nsfailure host_or_IP&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Thu, 10 Jun 2010 13:33:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645839#M676734</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-10T13:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645840#M676735</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Oops, we need to capture STDERR, so:&lt;BR /&gt;&lt;BR /&gt;# cat ./nsfailure&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;HOST=$1&lt;BR /&gt;RSLT=$(nslookup $1 2&amp;gt;&amp;amp;1 | sed -ne "/can.t find/p")&lt;BR /&gt;[ -z "${RSLT}" ] || mailx -s "nslookup failed: ${RSLT}" root &amp;lt; /dev/null&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;# ./nsfailure host_or_IP&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 10 Jun 2010 13:53:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645840#M676735</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-10T13:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645841#M676736</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;Thanks so much for your help. I'm modifying the script at the moment and it will be ready to go by tomorrow.&lt;BR /&gt;&lt;BR /&gt;I will let you know about the result.&lt;BR /&gt;&lt;BR /&gt;Thanks so much again!&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Tharshini</description>
      <pubDate>Thu, 10 Jun 2010 15:20:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645841#M676736</guid>
      <dc:creator>Tharshini</dc:creator>
      <dc:date>2010-06-10T15:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645842#M676737</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;Since you are new to this forum, welcome!  &lt;BR /&gt;&lt;BR /&gt;If/when you are satisfied with the answers you have received, please read:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 10 Jun 2010 15:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645842#M676737</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-10T15:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645843#M676738</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;When I tried to run the script, it did not accept and gave this error continuously.&lt;BR /&gt;`RSLT=$' unexpected.&lt;BR /&gt;&lt;BR /&gt;This is the script:&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;cat /disk1r1/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora | cut -d= -f3 | grep -v 10 | grep -v 192 | grep -v ")" | sed 's/\(.*\)./\1/' &amp;gt;&amp;gt; output.txt&lt;BR /&gt;&lt;BR /&gt;log="/apps/dba/bin/output.txt"; export log&lt;BR /&gt;rm log&lt;BR /&gt;&lt;BR /&gt;for HOSTNAME in `more log`&lt;BR /&gt;do&lt;BR /&gt;RSLT=$(nslookup $HOSTNAME 2&amp;gt;&amp;amp;1 | sed -ne "/can.t find/p")&lt;BR /&gt;[ -z "${RSLT}" ] || mailx -s "nslookup failed: ${RSLT}" root &amp;lt; /dev/null&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;Thanks for helping me out.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Tharshini</description>
      <pubDate>Fri, 11 Jun 2010 06:32:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645843#M676738</guid>
      <dc:creator>Tharshini</dc:creator>
      <dc:date>2010-06-11T06:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645844#M676739</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; When I tried to run the script, it did not accept and gave this error continuously.&lt;BR /&gt;`RSLT=$' unexpected.&lt;BR /&gt;&lt;BR /&gt;What shell are you running on what HP-UX release?  '/bin/sh' should point to '/usr/bin/sh' which should be the POSIX shell.&lt;BR /&gt;&lt;BR /&gt;The notation:&lt;BR /&gt;&lt;BR /&gt;RSLT=$(nslookup ${HOST} 2&amp;gt;&amp;amp;1 | sed -ne '/can.t find/p')&lt;BR /&gt;&lt;BR /&gt;...is a better (POSIX) form of the archaic back-ticks:&lt;BR /&gt;&lt;BR /&gt;RSLT=`(nslookup ${HOST} 2&amp;gt;&amp;amp;1 | sed -ne '/can.t find/p'`&lt;BR /&gt;&lt;BR /&gt;See if the back-tick syntax fixes your problem.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 11 Jun 2010 11:46:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645844#M676739</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-11T11:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645845#M676740</link>
      <description>&amp;gt;it did not accept and gave this error continuously&lt;BR /&gt;&amp;gt;for HOSTNAME in `more log`&lt;BR /&gt;&lt;BR /&gt;You shouldn't be using more(1) here, that's for interactive use.  Instead use:&lt;BR /&gt;for HOSTNAME in $(&amp;lt; log); do&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF: See if the back-tick syntax fixes your problem.&lt;BR /&gt;&lt;BR /&gt;You left in a "(":&lt;BR /&gt;RSLT=`nslookup ${HOST} 2&amp;gt;&amp;amp;1 | sed -ne '/can.t find/p'`</description>
      <pubDate>Fri, 11 Jun 2010 11:53:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645845#M676740</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-06-11T11:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645846#M676741</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: You shouldn't be using more(1) here, that's for interactive use. Instead use:&lt;BR /&gt;for HOSTNAME in $(&amp;lt; log); do&lt;BR /&gt;&lt;BR /&gt;If Tharshini is running a non-POSIX shell, I think that this too will be an issue.  I would suggest the alternative:&lt;BR /&gt;&lt;BR /&gt;for HOSTNANE in `cat log`; do&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis &amp;gt; JRF: You left in a "(":&lt;BR /&gt;RSLT=`nslookup ${HOST} 2&amp;gt;&amp;amp;1 | sed -ne '/can.t find/p'`&lt;BR /&gt;&lt;BR /&gt;Yes indeed I did.  Thanks for catching that.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jun 2010 12:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645846#M676741</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-11T12:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645847#M676742</link>
      <description>&amp;gt;JRF: If Tharshini is running a non-POSIX shell,&lt;BR /&gt;&lt;BR /&gt;But Tharshini said: This is the script:&lt;BR /&gt;#!/bin/sh</description>
      <pubDate>Fri, 11 Jun 2010 12:19:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645847#M676742</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-06-11T12:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645848#M676744</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Dennis: But Tharshini said: This is the script: #!/bin/sh&lt;BR /&gt;&lt;BR /&gt;And I saw that as I noted, but I'm not convinced (and asked specifically) if this was HP-UX and what version thereof.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 11 Jun 2010 12:24:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645848#M676744</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-11T12:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script to email about nslookup failure</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645849#M676747</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;Link to a general email script that can also send an attachment. Easily adaptable.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.ws/mailfile2" target="_blank"&gt;http://hpux.ws/mailfile2&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Change it before you use it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 11 Jun 2010 13:35:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-to-email-about-nslookup-failure/m-p/4645849#M676747</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2010-06-11T13:35:09Z</dc:date>
    </item>
  </channel>
</rss>

