diff --git a/AntMinerGetAllpool b/AntMinerGetAllpool index 419db08..6215f39 100755 --- a/AntMinerGetAllpool +++ b/AntMinerGetAllpool @@ -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") diff --git a/AntMinerGetAllstats b/AntMinerGetAllstats index 75e9b69..b8193c5 100755 --- a/AntMinerGetAllstats +++ b/AntMinerGetAllstats @@ -9,8 +9,9 @@ set -o nounset ADDRESS=$1 PORT=$2 +TIMEOUT=0.5 -stats_raw=`echo '{"command":"stats"}' | nc $ADDRESS $PORT | tr -d '\0\n'` +stats_raw=`echo '{"command":"stats"}' | timeout $TIMEOUT nc $ADDRESS $PORT | tr -d '\0\n'` stats_raw=$(sed 's/}{/\},{/' <<< "$stats_raw") STATS=$(jq '.STATS' <<< "$stats_raw")