need a small script

Hello all,
i have a batmail process running on my machine(java process).

i just need a script we should detect whether the batchnail is running or not.If not it should restart it.

Can anyone assist me on this?


while : ; do

ps -deaf | grep name-of-java-process | grep -v grep | wc -l | read count

if [ $count -eq 0 ]; then
  echo kicking off java thing at `date`
  kick-off-my-java-thing ### javac javathing?
fi

sleep 10

done