Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script Help

Status
Not open for further replies.

jdhinze

MIS
Jul 14, 1999
35
US
I am writing a script to check several servers and to report id the filesystem is over 90 % full.

Im server does not like the @i = $i +1 it returns a syntax error. I have tried to modify the scrip using i = `expr $i + 1 ' in place of the @i line . the system does not like this either .
Below is a copy of script with current output and what the end product should look like.

Any insight would be appreciated.

below copy of script.
******************************
#!/bin/csh
set limit = 90
set comp_list = 'box1 box2 box3'

touch /tmp/comp
rm /tmp/comp
foreach comp ( $comp_list )
set df = `rsh $comp df -lk |grep -v 'capa' |awk '{print $5}' |sed -e s/\%//`
set mnt = `rsh $comp df -lk |grep -v 'capa' |awk '{print $6}'`
set i = 0
foreach use ( $df )
@ i = $i +1
if ( "$use" > "$limit" ) then
echo " $use% on $comp $mnt[$i]" >> /tmp/comp
endif
end
end
if ( -f /tmp/comp ) then
mailx -s &quot;disk Capasity Alert&quot; adm < /tmp/comp
endif

*******************

Current Output
91% on box1
92% on box1
95% on box1
95% on box2
99% on box3


Desired Output
91% on box1 /usr
92% on box1 /name
95% on box1 /name
95% on box2 /name
99% on box3 /name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top