like to share this beautiful shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting like to share this beautiful shell script
# 1  
Old 02-29-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Web Development

Vue.js component: Beautiful code highlighter

Sooner than later I will render forum discussions in Vue.js to complement the standard way of showing forum threads. Today, I ran across this component, vue-code-highlight Beautiful code syntax highlighting as Vue.js component. https://www.unix.com/members/1-albums225-picture1199.jpg ... (1 Reply)
Discussion started by: Neo
1 Replies

2. Shell Programming and Scripting

On korn shell, how to share history between regular user and root?

I'm exploring OpenBSD and want to stick to its default shell, which is ksh. My goal is for my regular user ("bruno") and root user to have a shared history file. However, it seems that when running as root, ksh refuses to write to a HISTFILE that is owned by non-root user. This illustrates the... (3 Replies)
Discussion started by: DevuanFan
3 Replies

3. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

4. Shell Programming and Scripting

Help with data reformat if share share content

Input data: read1_data1 read1_data1 read2_data1 read3_data1 read4_data1 read4_data1 read4_data1 read5_data1 . . Desired output result: read1_data1 read1_data2 read2_data1 read3_data1 read4_data1 (3 Replies)
Discussion started by: perl_beginner
3 Replies

5. UNIX for Advanced & Expert Users

Share a space watcher shell program

Just try to contribute to the forum as a way of my think you to all people help me with questions that I posted. The space watcher shell allows you to define a list of file systems and percentage threshod and a list of email address that you want to send email when the threshod has been... (0 Replies)
Discussion started by: TheGunMan
0 Replies

6. UNIX for Dummies Questions & Answers

Watch for File on Windows share using Shell Script

I want to poll a particular file on a Windows shared drive using shell script and copy it to a Unix directory if present. Step wise execution: 1) Poll/watch for a file in the following location on Windows share: (SRC_DIR=\\mum\dharmesh\research\ST_DXR_20080821 to DXR.xls) 2) If present,... (1 Reply)
Discussion started by: dharam_v
1 Replies

7. Shell Programming and Scripting

Watch for File on Windows share using Shell Script

Watch for File on Windows share using Shell Script I want to poll a particular file on a Windows shared drive using shell script and copy it to a Unix directory if present. Step wise execution: 1) Poll/watch for a file in the following location on Windows share:... (1 Reply)
Discussion started by: dharam_v
1 Replies
Login or Register to Ask a Question