New script

This commit is contained in:
3err0
2019-06-03 11:07:46 +08:00
parent 03d2ec9190
commit 5c720a987d
2 changed files with 23 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/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