Testing telnet connections in a script

Hi,

I am trying to figure out how to test to see if a server is accepting telnet connections via a script.

I have several remote MPE servers that are set in single user mode (and hence not accepting telnet connections), for their backups, I want to try and automate a test (from a unix server), to see if telnet connections are available and hence if the servers are still in single user mode.

Hmm ... not sure how clear that was ... I basically want to do something like this:

while true
do
telnet <server_name> > richtmp &
echo $! > richtmp.PID
some kind of grep thing on 'richtmp' to see if the connection worked
kill `cat richtmp.PID`
sleep 60
done

.... but more elegantly. Is there an option to the telnet command that will do this?

many thanks,

Richard