Hi ,
Im trying to monitor 2 instancesof a process on our solaris server and trying to do a notification if the returned process size is greater than 500M.
Since there are two variables returned I want to make use of arrays to check each and every variable that is stored. the issue that im facing is that how can i assign the output of 'top | grep siebmtshmw | grep -v grep | awk '{print $6}' to a array ??
if i do something like
#!/bin/bash
proc[]=top| grep siebmtshmw |awk '{print $6}'|sed 's/\%//'
echo ${proc[@]} ---Returns a wrong value
for ((i = 0 ; i < ${#proc[@]} ; i++ ))
do
echo ${proc[$i]}
*** i will put the logic to check if the variables are greater than 500***
echo $i
echo ******
done
____________________
hercule1:sadmin\>top | grep siebmtshmw | grep -v grep | awk '{print $6}'
the above command returns the below vars
344M
53M
I need to store what ever is returned by top | grep siebmtshmw | grep -v grep | awk '{print $6}' into variables of a array .
Any help/suggestion is appreciated.