Sponsored Content
Top Forums Shell Programming and Scripting like to share this beautiful shell script Post 302171653 by girish.batra on Friday 29th of February 2008 06:22:39 AM
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
 

7 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

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. 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

6. 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

7. 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
platform::shell(3tcl)					       Tcl Bundled Packages					     platform::shell(3tcl)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(3tcl)
All times are GMT -4. The time now is 11:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy