You could have your script telnet to port 22 and check for the proper SSH
response. Mine answers with:
SSH-1.99-OpenSSH_2.3.0p1
Karl Cunningham
This situation i'm trying to work with is like this: There is sshd
>running on a box, and there is a script watching to make sure that it's
>running. But if someone
>logs in via ssh, another sshd process gets spawned for that connection. If
>that person were to
>somehow kill the sshd server process (the parent of the spawned sshd) then
>s/he could continue on
>with the connection but nobody else would be able to get in. The watchdog
>would not know this
>because it would see a sshd in the process list, which is all it is
>checking for. But i would like
>
>it to be able to check if the sshd that it's seeing in the process list is
>actually serving ssh
>or if it is not serving ssh.