Files
zabbix-mining/AntMinerGetAllpool
T

21 lines
365 B
Bash
Raw Normal View History

2019-06-03 11:07:46 +08:00
#!/bin/bash
up=`/usr/bin/fping -c1 -t300 $1 &> /dev/null ; echo $?`
if [ $up = 0 ]; then
set -o errexit
set -o nounset
ADDRESS=$1
PORT=$2
pools_raw=`echo '{"command":"pools"}' | nc $ADDRESS $PORT | tr -d '\0\n'`
pools_raw=$(sed 's/}{/\},{/' <<< "$pools_raw")
POOLS=$(jq '.POOLS' <<< "$pools_raw")
#fan_num=$(jq -r '.[1].fan_num' <<< "$STATS")
echo $POOLS
fi