I am writing a small script in that I want collect all servers of /opt and /stage.
Below is my small script
#!/bin/ksh
#checking Media server opt_Disk_Space_logs
myclient=`cat media_server.txt`
> opt_logs.txt
printf " Server Name\tsize\tused\tavail\tcapacity\tMounted on\n"
for i in $myclient
do
j=`sudo xxxxxx $i df -h |egrep -i "/opt|/stage" | awk '{print $2, "\t", $3, "\t", $4, "\t", $5,"\t", $6}'`
printf "\n $j"
done
echo""
echo""
the output as below.
Server Name size used avail capacity Mounted on
13G 7.8G 4.9G 62 /opt
300G 268G 32G 90 /stage
but I want, some more in depth means.
If column 62 is more than 90 I need warming message
a=90
echo "out of opt_out"
echo $opt_out
if [ "$opt_out" -ge "$a" ]
then
printf "%s\t WARNING NEED TO CHECK NOW /opt \n",$opt
else
printf "%s\tGood Required space\n",$opt
echo "$opt_out Good Required space"
fi
I know the above script as some problem, it is not give any correct output
Please provide the exact script.. The out put should be as below..
AND also I am checking many server as
server 1
13G 7.8G 4.9G 62 /opt Good, Required space avilable
300G 268G 32G 90 /stage WARNING NEED TO CHECK NOW
server 2
13G 7.8G 4.9G 62 /opt Good, Required space avilable
300G 268G 32G 90 /stage WARNING NEED TO CHECK NOW
.....
etc
Understand the difference (mayhap reading man pages?) between print and printf and you should be able to find out yourself.
Colour, however, is working fine!
You are not giving any suggestion , I was upset your comments.
But Now I did myself Because of you
Your Encouragement is Awesome mate. I am sooooooo Happy now. I doing my self.
FIRST I SHOULD LEARN THE BASICS, WITHOUT GOOGLE FOR EACH ISSUES.
Thanks lot mate
---------- Post updated at 08:05 PM ---------- Previous update was at 08:05 PM ----------
I'm glad you got the right mind set. And - as you can see - it is selfrewarding (may not be a proper English word but fits exactly) getting your own script to do what you want it to do.
Of course we could write the scripts for you, now, and the times to come. Would it help? I doubt it. Now you can write all your scripts if need be. And, of course, we are happy to help should specific problems arise in the future.