- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Script
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
Forums
Discussions
Discussions
Discussions
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
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-16-2002 09:29 PM
10-16-2002 09:29 PM
I am writing a shell script which will give me the database free space information and alert. I am getting the following output :
ds1dbs
5000000
991156
tmpdbs
1000000
999944
c3dbs
2000000
932508
s2dbs
5000000
1860968
rootdbs
512000
8815
testdbs
4000000
1087746
My requirement is that the script will calculate the percentage for all the above database like for testdbs:
1087746/4000000*100=27.19%.
If this percentage is more then 80% then it should send a mail to me?
Can anyone help me to get started?
Thanks,
Raje.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2002 10:06 PM
10-16-2002 10:06 PM
Re: Shell Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2002 10:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2002 10:20 PM
10-16-2002 10:20 PM
Re: Shell Script
ds1dbs 5000000 991156 19.82312
tmpdbs 1000000 999944 99.9944
c3dbs 2000000 932508 46.6254
s2dbs 5000000 1860968 37.21936
rootdbs 512000 8815 1.7216796875
testdbs 4000000 1087746 27.19365
l1:/tmp 112 >
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2002 11:12 PM
10-16-2002 11:12 PM
Re: Shell Script
using shell ... cat your input to this script :
#!/usr/bin/sh
while read DBS
do
read BLOCKS
read USED
read
PERC=$(($USED \* 100 / $BLOCKS))
[ "$PERC" -gt 80 ] &&
{
echo "\n$DBS has ${PERC}% blocks used\n" | mailx -s "Free space in $DBS" phelix
}
done
And you will receive :
Date: Thu, 17 Oct 2002 09:16:30 +0200 (METDST)
From: Jean-Louis Phelix
To: phelix
Subject: Free space in tmpdbs
tmpdbs has 99% blocks used
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2002 01:52 AM
10-17-2002 01:52 AM
Re: Shell Script
try the attached script with your input file as $1
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2002 03:08 AM
10-17-2002 03:08 AM
Re: Shell Script
Why did you give Jean-Louis Phelix only three (3) points and nothing to john korterman yet for what are obiviously correct answers?
Is there something they missed?
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2002 05:41 AM
10-18-2002 05:41 AM
Re: Shell Script
How about this:
perl -na00e 'printf "$F[0]:%.2f%%\n", $F[2]/$F[1]*100' database_output_file
Cheers,
Leslie