For some reason I have he following scenario:
On boot-up I'm launching a script which waits for a given amount of time and checks whether an SSH connection was astablished during this time window or not. If a connection is open, the script does action A, else it kills sshd and does B.
What would be the best way to detect an open connection? (The script can be written in Bash or Ruby)