rabin 5 years ago
parent
commit
85e5c924fa
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/shell/autossh/daemon

+ 10 - 3
src/shell/autossh/daemon

@@ -4,9 +4,16 @@ while true
 do
 	pids=`ps aux|grep "/usr/bin/ssh -f -NR"|grep -v entrypoint|grep -v grep|grep -v process|awk '{print $1}'`
 	if [ "$pids" ]; then
-	    sleep 60
+		sleep 86400
+		kill -9 $pids
 	else
-	    /data/dm/src/shell/autossh/expect $1 root $2 $3
-	    echo "ssh started"
+		epids=`ps aux|grep "/data/dm/src/shell/autossh/expect"|grep -v entrypoint|grep -v grep|grep -v process|awk '{print $1}'`
+		if [ "$epids" ]; then
+			kill -9 $epids
+		fi
+
+		/data/dm/src/shell/autossh/expect $1 root $2 $3
+		echo "ssh started"
+		sleep 60
 	fi
 done