watergrinder
MIS
I am using a script to administer current system as well as remote system disk space. When the script checks remote system, it exits completely without checking the current server. Any ideas?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
RUN="true"
calculate_disk_space () {
MAILFILE=$1
ServerName=$2
if [ "$ServerName" = "xxxx" ]; then
CMD="bdf -bi"
else
CMD="ssh $ServerName bdf -bi"
fi
echo "$ServerName"
$CMD | awk 'FNR > 1 {sub(/%/,"",$5); print $1, $2, $4, $5}' | while read Filesystem Kbytes Available Percent_Used
do
if [ "$Percent_Used" -gt 60 ]
then
# Display the header only once.
# Increment the total error count. Only once for each error type.
if [ "$RUN" = "true" ]; then
(( ALLERRS += 1 ))
display_header $MAILFILE "File System Errors"
fi
RUN="false"
# Print details to the file
echo "$Filesystem on $ServerName $Percent_Used% used Total: $Kbytes kb Available: $Available kb" >> $MAILFILE
fi
done
}
cat $DIR/monds.dat | awk '{print $1}' | while read ServerName
do
echo " hello"
calculate_disk_space $MAILFILE $ServerName
done
calculate_disk_space $MAILFILE remote1
calculate_disk_space $MAILFILE remote2
calculate_disk_space $MAILFILE local