#!/bin/bash
for i in `ps axlw | grep /usr/lib/autossh/autossh | grep -v grep | awk '{ print $3; }'`; do
  ps axlw | grep /usr/bin/ssh | grep -v grep | awk '{print $4;}' | grep -q $i
  if [ "$?" != "0" ]; then
    echo "autossh tunnel on `hostname` with PID $i is missing ssh process" | notify-operators "autossh tunnel on `hostname` with PID $i is missing ssh process"
  fi
done
