- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: need in 'bdf' script
Operating System - Linux
1753286
Members
5601
Online
108792
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2005 01:14 AM
тАО12-15-2005 01:14 AM
Hi everybody
i wrote a script that informs you about the lv usage, if the usage is more than a value.(if lv name is long 'bdf' writes some values to the next line.) my problem is, this script never gives the last value of bdf. please try it in your system. and please help. :) i think there is a small trick, but i could not find.
arper=gives %usage
arpernxt=gives %usage (if lv name is long and %usage at the next line)
export date=`date +%d_%m_%y`
set -A arper $(bdf|awk '{print $5}'|cut -f1 -d "%")
set -A arpernxt $(bdf|awk '{print $4}'|cut -f1 -d "%")
set -A armnt $(bdf|awk '{print $6}'|cut -f1 -d "%")
set -A armntnxt $(bdf|awk '{print $5}'|cut -f1 -d "%")
i=0
echo "Total number of lv:"${#arper[@]}
while (( $i < ${#arper[@]} ))
do
if [[ ${arper[$i]} > 64 || ${arpernxt[$i+1]} > 64 ]]
then
if [ ${arper[$i]} ]
then
case "${arper[$i]}" in
[0-9]*)
echo ${arper[$i]} ${armnt[$i+1]}
;;
*)
echo ${arpernxt[$i+1]} ${armntnxt[$i]}
;;
esac
fi
fi
i=$(($i+1))
done
i wrote a script that informs you about the lv usage, if the usage is more than a value.(if lv name is long 'bdf' writes some values to the next line.) my problem is, this script never gives the last value of bdf. please try it in your system. and please help. :) i think there is a small trick, but i could not find.
arper=gives %usage
arpernxt=gives %usage (if lv name is long and %usage at the next line)
export date=`date +%d_%m_%y`
set -A arper $(bdf|awk '{print $5}'|cut -f1 -d "%")
set -A arpernxt $(bdf|awk '{print $4}'|cut -f1 -d "%")
set -A armnt $(bdf|awk '{print $6}'|cut -f1 -d "%")
set -A armntnxt $(bdf|awk '{print $5}'|cut -f1 -d "%")
i=0
echo "Total number of lv:"${#arper[@]}
while (( $i < ${#arper[@]} ))
do
if [[ ${arper[$i]} > 64 || ${arpernxt[$i+1]} > 64 ]]
then
if [ ${arper[$i]} ]
then
case "${arper[$i]}" in
[0-9]*)
echo ${arper[$i]} ${armnt[$i+1]}
;;
*)
echo ${arpernxt[$i+1]} ${armntnxt[$i]}
;;
esac
fi
fi
i=$(($i+1))
done
Solved! Go to Solution.
- Tags:
- bdf
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2005 01:20 AM
тАО12-15-2005 01:20 AM
Re: need in 'bdf' script
Hi:
Bill Hassell has addressed this before. See here, for instance:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=214093&admit=-682735245+1134656327208+28353475
Regards!
...JRF...
Bill Hassell has addressed this before. See here, for instance:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=214093&admit=-682735245+1134656327208+28353475
Regards!
...JRF...
- Tags:
- bdfmegs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2005 02:11 AM
тАО12-15-2005 02:11 AM
Solution
As mentioned in the reply from James, bdf does indeed break up the line into two parts. The simplest solution is to read all the values for each line and if the trailing values are empty, read again. The breakpoint for bdf is always the same. Here is a snippet of code:
bdf -l |
while read FS TOT USED AVAIL PERCENT MNT
do
if [ "$TOT" = "" ]
then
read TOT USED AVAIL PERCENT MNT
fi
print $FS $TOT $USED $AVAIL $PERCENT $MNT
done
This will normalize bdf into all 1-line strings for each mountpoint.
Bill Hassell, sysadmin
bdf -l |
while read FS TOT USED AVAIL PERCENT MNT
do
if [ "$TOT" = "" ]
then
read TOT USED AVAIL PERCENT MNT
fi
print $FS $TOT $USED $AVAIL $PERCENT $MNT
done
This will normalize bdf into all 1-line strings for each mountpoint.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2005 06:29 PM
тАО12-15-2005 06:29 PM
Re: need in 'bdf' script
Thank you so much.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP