- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Shell script for checking filesystems
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
05-15-2001 12:18 AM
05-15-2001 12:18 AM
I would like to check available space of each filesystem on my box with the shell script. This script I will run from the cron. When the available space decrease under the limit I would like to get the message in my mail box.
Could you help me and tell me where can I get a script with my requirements.
Thanks,
Matjaz
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 12:47 AM
05-15-2001 12:47 AM
Re: Shell script for checking filesystems
How about using Big Brother, it does what you want plus much more...
http://bb4.com/
Good luck
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 12:59 AM
05-15-2001 12:59 AM
Re: Shell script for checking filesystems
if [ $# -le 0 ] ;
then TRESHOLD=90 ;
else TRESHOLD=$1 ;
fi
# echo "Using Treshold = $TRESHOLD"
AAA_HOSTS='host1 host2 host3'
#> /tmp/report.log
#echo "Server\t\tFile System\t\tOccupation (>$TRESHOLD%)"
for h in $AAA_HOSTS ;
do
remsh $h -l root -n bdf | awk -v m=$h '{ if (NF==5) { d=substr($4,1,leng
th($4)-1) ; print m"@"$5"@"d } } { if (NF==6) { d=substr($5,1,length($5)-1) ; pr
int m"@"$6"@"d }}' | awk -F "@" -v t=$TRESHOLD '{ ORS="" ; if ($3>t) { print $1
; for (i=0;i<17-length($1);i++) print " " ; print $2 ; for (i=0;i<25-length($2);
i++) print " " ; print $3"%\n" } }'
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 01:06 AM
05-15-2001 01:06 AM
Re: Shell script for checking filesystems
This script will run on Virtual Vault, so 3-rd party software is irrelevant. The system is without Perl too.
regards,
Matjaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 01:18 AM
05-15-2001 01:18 AM
Re: Shell script for checking filesystems
if [[ $(print $MOUNT | awk ' { print substr($1,1,1) } ') != '#' && $(print $
MOUNT | awk ' { print substr($1,1,1) } ') != '' ]] then
if bdf | egrep -v egrep | egrep $MOUNT 1>/dev/null 2>&1
then PERUSED=$(bdf $MOUNT | egrep -v [Uu]sed | awk {'print $5'})
PERUSED=${PERUSED%'%'}
if [[ $PERUSED -gt $PERCENTFLAG ]] then
print "${0##*/}: $MOUNT file system is $PERUSED% full"
echo "${0##*/}": $HOSTNAME $MOUNT file system is $PERUSED% full | mail
x -s "file system full" root
else
print "$MOUNT $PERCENTFLAG% OK..."
fi
else
print "file system $MOUNT does not exist"
fi
---------
config file like this
/home 80
/u101 90
/u102 90
/u103 90
/u104 90
---------
#fscheck config_file
it will checking with bdf , if exceed as specify in config file , it will mail to root.
---------
I cut from a part of a script , may be you need to modify
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 12:04 PM
05-15-2001 12:04 PM
Re: Shell script for checking filesystems
In ./scfs.dat, I put my static file systems, one fspath in each line, I don't want check them.
######################
# SCRIPT
######################
cd /usr/scripts
echo ""
echo " Sistemas de Archivo con Espacio Disponible < 25 MB o el 90% Ocupado"
echo "\n Muestra del: \c"
date +%d/%m/%y%t%X
bdf -l | grep -vf scfs.dat | sort -n +3 | awk -F " " '{ if ( NR==1 ) print " Espacio de Disco en MBytes\n\n Total Ocupado Disponible %usado Montado Dispositivo \n"; else if ( $4<25000 || $5>90 ) printf "%9.2f %9.2f %9.2f %3s %-10s %-26s\n", $2/1024, $3/1024, $4/1024, $5*1, $6, $1 }'
echo ""
##################
# FIN
##################
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2001 05:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2001 04:27 AM
05-16-2001 04:27 AM