2021-12-16

版权声明:本文为博主原创文章,转载注明“龙棠博客”字样和原文链接。

Bash循环

#!/bin/bash

while [ true ];
do
    num=`ps -ef |grep socat |wc -l`
    if [ $num -gt 1 ];
    then
        echo "Socat is running"
    else
        echo "Socat not runing, start now"
        nohup socat -d tcp:156.234.211.132:9996,forever,intervall=0.1,fork tcp:127.0.0.1:8081 &
    fi
    sleep 5
done