<?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 Ignore inactive vg in script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268847#M655710</link>
    <description>Hi everyone&lt;BR /&gt;&lt;BR /&gt;I am trying to write a script to check for unavailable and stale drives. &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;for vg in `vgdisplay | grep "VG Name" | awk -F"/" '{print $3}'`&lt;BR /&gt;do&lt;BR /&gt;   if  vgdisplay -v $vg | grep -q stale &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   then&lt;BR /&gt;      vg_msg="`hostname`:Volume Group $vg has a stale Logical Volume."&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   if  vgdisplay -v $vg | grep "PV Status" | grep -q unavailable &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   then&lt;BR /&gt;      vg_msg="`hostname`:Volume Group $vg has unavailable disk."&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;echo "$vg_msg"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The problem that I am having is that if I run across a vg that is not active I get the following output even though I am just looking for the vgname.&lt;BR /&gt;&lt;BR /&gt;In this case I even did a grep -v to ignore vgdisplay but I was not able to exclude the inactive vg.&lt;BR /&gt;&lt;BR /&gt;# vgdisplay | grep -v vgdisplay | grep "VG Name" | awk -F"/" '{print $3}'&lt;BR /&gt;vgdisplay: Volume group not activated.&lt;BR /&gt;vgdisplay: Cannot display volume group "/dev/aroot".&lt;BR /&gt;appsvg00&lt;BR /&gt;vg00&lt;BR /&gt;&lt;BR /&gt;Any ideas would be helpful.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
    <pubDate>Fri, 07 Jan 2011 20:38:29 GMT</pubDate>
    <dc:creator>rleon</dc:creator>
    <dc:date>2011-01-07T20:38:29Z</dc:date>
    <item>
      <title>Ignore inactive vg in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268847#M655710</link>
      <description>Hi everyone&lt;BR /&gt;&lt;BR /&gt;I am trying to write a script to check for unavailable and stale drives. &lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;for vg in `vgdisplay | grep "VG Name" | awk -F"/" '{print $3}'`&lt;BR /&gt;do&lt;BR /&gt;   if  vgdisplay -v $vg | grep -q stale &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   then&lt;BR /&gt;      vg_msg="`hostname`:Volume Group $vg has a stale Logical Volume."&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   if  vgdisplay -v $vg | grep "PV Status" | grep -q unavailable &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;   then&lt;BR /&gt;      vg_msg="`hostname`:Volume Group $vg has unavailable disk."&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;echo "$vg_msg"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The problem that I am having is that if I run across a vg that is not active I get the following output even though I am just looking for the vgname.&lt;BR /&gt;&lt;BR /&gt;In this case I even did a grep -v to ignore vgdisplay but I was not able to exclude the inactive vg.&lt;BR /&gt;&lt;BR /&gt;# vgdisplay | grep -v vgdisplay | grep "VG Name" | awk -F"/" '{print $3}'&lt;BR /&gt;vgdisplay: Volume group not activated.&lt;BR /&gt;vgdisplay: Cannot display volume group "/dev/aroot".&lt;BR /&gt;appsvg00&lt;BR /&gt;vg00&lt;BR /&gt;&lt;BR /&gt;Any ideas would be helpful.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jan 2011 20:38:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268847#M655710</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2011-01-07T20:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore inactive vg in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268848#M655711</link>
      <description>I believe that error is outputed on std-err..&lt;BR /&gt;&lt;BR /&gt;redirect it&lt;BR /&gt;&lt;BR /&gt;vgdisplay -v 2&amp;gt;/dev/null|grep blah etc.. etc..&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Jan 2011 20:47:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268848#M655711</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2011-01-07T20:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore inactive vg in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268849#M655712</link>
      <description>&amp;gt;did a grep -v to ignore vgdisplay but I was not able to exclude the inactive vg.&lt;BR /&gt;&lt;BR /&gt;Is this output going to stderr?  You either want to send it to /dev/null or redirect it to stdout.&lt;BR /&gt;vgdisplay 2&amp;gt; /dev/null | grep -v vgdisplay | ...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;vgdisplay -v $vg | grep -q stale &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;No need to redirect the non-existent grep output.  You may what to redirect vgdisplay stderr:&lt;BR /&gt;vgdisplay -v $vg 2&amp;gt; /dev/null | grep -q stale</description>
      <pubDate>Fri, 07 Jan 2011 20:48:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268849#M655712</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-01-07T20:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore inactive vg in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268850#M655713</link>
      <description>thanks that did it.</description>
      <pubDate>Mon, 10 Jan 2011 17:21:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ignore-inactive-vg-in-script/m-p/5268850#M655713</guid>
      <dc:creator>rleon</dc:creator>
      <dc:date>2011-01-10T17:21:04Z</dc:date>
    </item>
  </channel>
</rss>

