- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Newbie Brain Freeze Simple If Question
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
тАО10-28-2004 07:10 AM
тАО10-28-2004 07:10 AM
If $1 is > 80% AND (!grep "/opt/sc" $2) then do something
Can anyone help me with this. I've got brain freeze.
Thanks
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2004 07:19 AM
тАО10-28-2004 07:19 AM
Re: Newbie Brain Freeze Simple If Question
whatever you want.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2004 07:22 AM
тАО10-28-2004 07:22 AM
Re: Newbie Brain Freeze Simple If Question
/patrol
/opt
/opt/supra2/savelog
/opt/supra2/dbutil
/opt/sct2/dbl1
/opt/sct2/db01
/opt/sct1/dbl1
/opt/sct1/db01
/opt/scp1/dbl2
This is why I want to grep $2 and look for "/opt/sc". Can this be included in the statement?
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2004 07:25 AM
тАО10-28-2004 07:25 AM
Re: Newbie Brain Freeze Simple If Question
if echo $2|grep "/opt/sc">/dev/null; then
if [[ "$1" -gt 80 ]]; then
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2004 07:26 AM
тАО10-28-2004 07:26 AM
Re: Newbie Brain Freeze Simple If Question
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2004 07:32 AM
тАО10-28-2004 07:32 AM
Re: Newbie Brain Freeze Simple If Question
do
test "$1 -gt 80 -a $2 != "/opt/sc"" && "whatever you want"test "
done
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2004 12:49 AM
тАО10-29-2004 12:49 AM
SolutionFilesystem kbytes used avail %used Mounted on
so that,
we will be having $1 - %
$2 - FS then,
bdf | awk '!/^Filesystem/ { print $5" "$1 }' | while read per fs; do
if [[ $per -gt 80% && $fs = "/opt/sc" ]]
then
# do something
fi
done
Else simply with awk as,
bdf | awk '!/^Filesystem/ { if ( $5 > 80 && $1 == "/opt/sc")
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2004 02:19 AM
тАО10-29-2004 02:19 AM
Re: Newbie Brain Freeze Simple If Question
Thanks for all the input and now for my sloppy code.
bdf > /home/sysadmin/get_diskusage
awk '!/^Filesystem/ { print $5" "$6 }' /home/sysadmin/get_diskusage | while read preper fs; do
per=`echo "$preper" | awk '{print $1}' | cut -f1 -d'%'`
dugreen=1
if [ $per -gt 85 ]
then if [ `echo ${fs} | grep "/opt/sc"` ]
then dugreen=1
else duyellow=1
fi
fi
if [ $per -gt 90 ]
then if [ `echo ${fs} | grep "/opt/sc"` ]
then dugreen=1
else dured=1
fi
fi
done
if [ $dured ]
then IMG=redlight
elif [ $duyellow ]
then IMG=yellowlight
else IMG=greenlight
fi
print_image