add timeout

This commit is contained in:
3err0
2019-06-14 16:24:12 +08:00
parent 6ccb6e41fe
commit f46ac1c311
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -9,8 +9,9 @@ set -o nounset
ADDRESS=$1
PORT=$2
TIMEOUT=0.5
pools_raw=`echo '{"command":"pools"}' | nc $ADDRESS $PORT | tr -d '\0\n'`
pools_raw=`echo '{"command":"pools"}' | timeout $TIMEOUT nc $ADDRESS $PORT | tr -d '\0\n'`
pools_raw=$(sed 's/}{/\},{/' <<< "$pools_raw")
POOLS=$(jq '.POOLS' <<< "$pools_raw")