The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Complex Event Processing and SOA: a ?beautiful thing?? iBot Complex Event Processing RSS News 0 01-05-2008 12:00 AM
Apple OS X Leopard: A beautiful upgrade - InfoWorld iBot UNIX and Linux RSS News 0 10-17-2007 09:00 AM
How to Run a shell script from Perl script in Parent shell? hifake Shell Programming and Scripting 16 08-28-2007 09:42 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-29-2008
girish.batra girish.batra is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 74
like to share this beautiful shell script

Hello Everybody

I recently got this beautiful shell script from my friend. I like to share it with every body as I am bit new to shell scripting enviorment. I hope people in this site will like it. It is related to checking the filesystem threshold limit. After getting threshold limit of particular server filesystems . This script will show amount of filesystem full on the servers listed in a file called Delhosts. This script must be running continously 24*7

Any modification in this shell script is always welcome, to impove it


kind regards to all



/export/home/scripts->cat fsmonitor
#!/bin/sh
#Script to check the Delhi (IDC) Server status
/usr/bin/clear
while :
do
BASE=/export/home/scripts
LOG=/export/home/scripts/log;export LOG
PERC="%";export PERC
SZ=94;export SZ
echo "|---------------------------------------------------------------------------------------------|"
echo "Time: `date +%H:%M:%S` \t\t\t Date: `date +%d/%m/%y`"
#echo " \t \033[7m \033[5m FileSystem CHK of IDC Servers Greater Than $SZ% \033[0m \t "
echo " \t FileSystem CHK of IDC Servers Greater Than \033[7m \033[5m $SZ% \033[0m \t "
echo "|---------------------------------------------------------------------------------------------|"
echo "Ip-Addr\t\t MountPoints > Threshold Limit\t\t %SIZE "
echo "|---------------------------------------------------------------------------------------------|"
#echo "|---------------------------------------------------------------------------------------------|"
#echo "Ip-Addr\t\t MountPoints Greater than Threshold Limit\t\t %SIZE CronDaemon"
#echo "|---------------------------------------------------------------------------------------------|"

for i in `cat $BASE/Delhosts |awk '{print $1}'`
do
/usr/bin/rsh $i /usr/bin/df -k |egrep -v 'proc|fd|mntt|File|mir|ori'|awk '{print $5 $6}'|awk -F"%" '{print $1"#"$2}' >$LOG/size.out
for j in `cat $LOG/size.out`
do
Z=`/usr/bin/rsh $i /usr/sbin/ifconfig -a|grep net|grep 10 |head -1 |awk '{print $2}'`
#C=`/usr/bin/ps -ef|grep cron|grep -v grep |wc -l'`
SZ=`echo $j |awk -F"#" '{print $1}'`
MNT=`echo $j |awk -F"#" '{print $2}'`
if [ $SZ -ge 94 ]
then
echo "$Z\t$MNT\t\t\t $SZ$PERC"
#echo "$Z\t$MNT\t\t\t\t\t\t $SZ\t$C"
# else
# echo " "
fi
done

done
echo "\t\t\t\t\t\t\t Maintained by super user\n"
sleep 5
clear
done


/export/home/scripts->cat Delhosts
10.1.0.84 cm01
10.1.0.85 cm02
10.1.0.87 htappcm03
10.1.0.88 htappcm04
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0