<p>$LVM in $DF not defined</p>
<div class="gmail_quote">On Apr 26, 2011 7:38 AM, &quot;Damon Chesser&quot; &lt;<a href="mailto:dchesser@acsi2000.com">dchesser@acsi2000.com</a>&gt; wrote:<br type="attribution">&gt; Believe it or not, this is above my rudimentary bash skills and I have hit a wall:  So I am seeking advice or pointers.<br>
&gt; <br>&gt; Scenario:  recording Volume Group info on a server by server bases.<br>&gt; <br>&gt; It did not take me long to realize that I wanted to script this.  I am putting the output of my script into a spread sheet (copy and paste).  The servers I am running this on are remote and I have no convenient way to get the output text to my workstation, so copy and paste works.<br>
&gt; <br>&gt; Desired output:<br>&gt; <br>&gt; VGname VGsize  LVname LVsize LVmount_point %diskused<br>&gt; <br>&gt; I have all the above working up to LVmount where it all goes horribly bad.  Here is my code:<br>&gt; -----start-----<br>
&gt; #!/bin/bash<br>&gt; <br>&gt; FILE=/tmp/dlc/vginfo_script.txt<br>&gt; <br>&gt; rm $FILE<br>&gt; <br>&gt; for VG in `vgdisplay | grep -e &quot;VG Name&quot; | awk &#39;{print $3}&#39;`<br>&gt; do<br>&gt;   VGsize=`vgdisplay $VG |grep -e &quot;VG Size&quot; | awk &#39;{print $3 $4}&#39;`<br>
&gt;   for LV in `vgdisplay -v $VG |grep &quot;LV Name&quot; |  cut -d\/ -f4`<br>&gt;   do<br>&gt;     LVsize=`lvdisplay /dev/$VG/$LV  | grep &quot;LV Size&quot; | awk &#39;{print $3 &quot; &quot; $4}&#39;`<br>&gt; #    for MNTP in `mount |grep &quot;$LVM&quot; | awk &#39;{print $3}&#39;`<br>
&gt; #    do<br>&gt; #      DF=`df -T &quot;$MNTP&quot; |awk &#39;{print $6}&#39;`<br>&gt; #    done<br>&gt;     echo $VG $VGsize $LV $LVsize $MNTP $DF<br>&gt;   done<br>&gt; done  &gt; $FILE<br>&gt; <br>&gt; ---end----<br>
&gt; <br>&gt; The above code, as written outputs this:<br>&gt; <br>&gt; vgorabak8 375.00GB lvorabak8 374.90 GB<br>&gt; vgorabak7 375.00GB lvorabak7 374.90 GB<br>&gt; <br>&gt; take out the # above and it does this:<br>&gt; <br>
&gt; vgorabak8 375.00GB lvorabak8 374.90 GB /var/lib/ntp/proc Use% -<br>&gt; vgorabak7 375.00GB lvorabak7 374.90 GB /var/lib/ntp/proc Use% -<br>&gt; <br>&gt; No idea why.  This makes my head hurt.  I have tried everything I can think of.  It seems I don&#39;t think enough!<br>
&gt; <br>&gt; Any help would be appreciated.<br>&gt; <br>&gt; <br>&gt; <br>&gt; <br>&gt;  Sincerely,<br>&gt; <br>&gt; Damon Chesser<br>&gt; <a href="mailto:dchesser@acsi2000.com">dchesser@acsi2000.com</a><br>&gt; <br>&gt; <br>
&gt; <br>&gt; ________________________________<br>&gt; Disclaimer: This electronic transmission and any attachments contain confidential information belonging to the sender. This information may be legally protected. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient or receive this message in error, you are hereby notified that any disclosure, copying, distribution or taking of any action in reliance on or regarding the contents of this information is strictly prohibited. Please notify the sender immediately if you have received this information in error.<br>
&gt; <br>&gt; <a href="http://www.acsi2000.com">www.acsi2000.com</a><br></div>