Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # This script harvest some data from Coyote Pool PTS pool
- # Autor: Yago
- # License: WTFPL http://www.wtfpl.net/txt/copying/
- MINING_PORT=4444
- POOL_IP=162.243.45.158
- HTTP_TIMEOUT=5 # seconds
- MINING_TIMEOUT=5 # seconds
- TMP=/tmp/coyote-stats
- mkdir -p $TMP
- harvest() {
- # harvest some info
- SOME_INFO=`perl -pe 's/<br\/>\n/,/g' $TMP/index.html | perl -pe 's/,</\n/g' | grep Shares | perl -pe 's/,/, /g'`
- # harvest number of addresses listed
- NUMBER_ADDRESSES=`grep '<td>' $TMP/index.html | wc -l`
- }
- checkminingport() {
- nc -z -w$MINING_TIMEOUT $POOL_IP $MINING_PORT
- if [ $? -eq 0 ]; then
- MINING_PORT_STATUS="$MINING_PORT:up"
- else
- MINING_PORT_STATUS="$MINING_PORT:DOWN :("
- fi
- }
- # check http
- wget --quiet --timeout=$HTTP_TIMEOUT http://$POOL_IP -O $TMP/index.html
- if [ $? -eq 0 ]; then
- harvest
- checkminingport
- echo "Coyote Pool status: HTTP:80 up, Mining: $MINING_PORT_STATUS, $SOME_INFO, Addresses with pending payouts: $NUMBER_ADDRESSES"
- else
- checkminingport
- echo "Coyote Pool status: HTTP:80 down :/, Mining: $MINING_PORT_STATUS, Shares, Balance and addresses with pending payouts: data source down."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement