[ale] bash assistance
Jim Kinney
jim.kinney at gmail.com
Tue Apr 26 12:04:26 EDT 2011
yeah. The long name causes a line wrap. But the latest coreutils here
doesn't change that.
Need to change the process to be
for mntp in /dev/mapper/vg1_foo /dev/mapper/vg2_foobar;
do
echo "$mntp $(df -T $mntp | grep "^ " | awk '{print $5}')"
done
On Tue, Apr 26, 2011 at 9:03 AM, Michael Trausch <mike at trausch.us> wrote:
> This is because you have a long volume name. Upgrading to latest coreutils
> may help.
>
> --
> Sent from my phone... a G2 running CM7 nightlies!
> On Apr 26, 2011 9:02 AM, "Damon Chesser" <dchesser at acsi2000.com> wrote:
> > Typo/Stupid user mistake corrected, but it still does a thing I don’t
> know how to fix:
> >
> > Output of the command with typo corrected and # removed:
> >
> > vgoradata 1.37TB lv008dat 100.00 GB /u008 Available 57%
> > vgoradata 1.37TB lv010dat 100.00 GB /u010 Available 1%
> > vgoradata 1.37TB lv012dat 100.00 GB /u012 Available 1%
> >
> > df -T output is:
> >
> > df -T /u008
> > Filesystem Type 1K-blocks Used Available Use% Mounted on
> > /dev/mapper/vgoradata-lv008dat
> > reiserfs 104854396 59278980 45575416 57% /u008
> >
> > The above is exactly as it appears in my term (at least in my email
> client)
> >
> > So why does df -T "$MNTP" |awk '{print $5}' produce “Available 57%” when
> the 6th field is actually the one that holds the %used?
> >
> > df -T /u008 |awk '{print $6}'
> > Use%
> >
> > /u008
> >
> > And how can I clean up the output to only display %used as a number% like
> 57%?
> >
> > Is there a different command I can run to find this number? (I am looking
> for candidates for increased space).
> >
> >
> >
> > Sincerely,
> >
> > Damon Chesser
> > dchesser at acsi2000.com<mailto:dchesser at acsi2000.com>
>
> >
> >
> > From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of Jim
> Kinney
> > Sent: Tuesday, April 26, 2011 8:18 AM
> > To: Atlanta Linux Enthusiasts
> > Subject: Re: [ale] bash assistance
> >
> >
> > $LVM in $DF not defined
> > On Apr 26, 2011 7:38 AM, "Damon Chesser" <dchesser at acsi2000.com<mailto:
> dchesser at acsi2000.com>> wrote:
> >> Believe it or not, this is above my rudimentary bash skills and I have
> hit a wall: So I am seeking advice or pointers.
> >>
> >> Scenario: recording Volume Group info on a server by server bases.
> >>
> >> 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.
> >>
> >> Desired output:
> >>
> >> VGname VGsize LVname LVsize LVmount_point %diskused
> >>
> >> I have all the above working up to LVmount where it all goes horribly
> bad. Here is my code:
> >> -----start-----
> >> #!/bin/bash
> >>
> >> FILE=/tmp/dlc/vginfo_script.txt
> >>
> >> rm $FILE
> >>
> >> for VG in `vgdisplay | grep -e "VG Name" | awk '{print $3}'`
> >> do
> >> VGsize=`vgdisplay $VG |grep -e "VG Size" | awk '{print $3 $4}'`
> >> for LV in `vgdisplay -v $VG |grep "LV Name" | cut -d\/ -f4`
> >> do
> >> LVsize=`lvdisplay /dev/$VG/$LV | grep "LV Size" | awk '{print $3 " "
> $4}'`
> >> # for MNTP in `mount |grep "$LVM" | awk '{print $3}'`
> >> # do
> >> # DF=`df -T "$MNTP" |awk '{print $6}'`
> >> # done
> >> echo $VG $VGsize $LV $LVsize $MNTP $DF
> >> done
> >> done > $FILE
> >>
> >> ---end----
> >>
> >> The above code, as written outputs this:
> >>
> >> vgorabak8 375.00GB lvorabak8 374.90 GB
> >> vgorabak7 375.00GB lvorabak7 374.90 GB
> >>
> >> take out the # above and it does this:
> >>
> >> vgorabak8 375.00GB lvorabak8 374.90 GB /var/lib/ntp/proc Use% -
> >> vgorabak7 375.00GB lvorabak7 374.90 GB /var/lib/ntp/proc Use% -
> >>
> >> No idea why. This makes my head hurt. I have tried everything I can
> think of. It seems I don't think enough!
> >>
> >> Any help would be appreciated.
> >>
> >>
> >>
> >>
> >> Sincerely,
> >>
> >> Damon Chesser
> >> dchesser at acsi2000.com<mailto:dchesser at acsi2000.com>
>
> >>
> >>
> >>
> >> ________________________________
> >> 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.
> >>
> >> www.acsi2000.com<http://www.acsi2000.com>
>
> >
> >
> _____________________________________________________________________________
> > Scanned by IBM Email Security Management Services powered by MessageLabs.
> For more information please visit
> http://www-935.ibm.com/services/us/index.wss/offerfamily/iss/a1026954
> >
> _____________________________________________________________________________
> >
> > ________________________________
> > 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.
> >
> > www.acsi2000.com
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
--
--
James P. Kinney III
As long as the general population is passive, apathetic, diverted to
consumerism or hatred of the vulnerable, then the powerful can do as they
please, and those who survive will be left to contemplate the outcome.
- *2011 Noam Chomsky*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20110426/c6441ad0/attachment.html
More information about the Ale
mailing list