Pls Help me out ... I want to check process status at regular intervals of time

I want to check process status at regular interval of time ...
so i ha wirtten this BUT its not working when i placed this peace of code in .sh ..
please help me out

#!/bin/sh
w = ps -ef|grep processname | wc - l
echo $w
if [ $w -lt 3 ] ; then
Banner "Proceesname Problem"
else
Banner " Running Fine"
fi

Please help me out with necessary modification .
Thanks in advance...

try code tags....

#!/bin/sh
w = $(ps -ef|grep $processname | grep-v 'grep' | wc - l )
echo $w
if [ $w -lt 3 ] ; then 
echo "$processname Problem"
else 
echo " Running Fine"
fi

hi jim,
Thank you very much,
I got the solution and the problem is when we are trying taking variable "w" it is giving some errors i think "w" is internal system parameter .
I tried it with taking "t" as variable it got executed.

Thank you once again for helping me out JIM.

Lastly i have one dought "ps -ef|grep $processname | grep-v 'grep' | wc - l"
why did you grep -v 'grep' i havent used like this any time.

Hi Srini,

grep -v 'grep' would tend to filter the process output, not to include grep process.. Remember that it may be included as a process, and would confusions. So to be safe, that was added...

You can replace ps, grep and wc by pgrep

#!/bin/sh
if [ $(pgrep -c processname) -lt 3 ] ; then 
       echo "$processname Problem"
else 
       echo " Running Fine"
fi

See also KILL without PID - Page 3