Skip to content

Instantly share code, notes, and snippets.

@mraaroncruz
Created June 5, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mraaroncruz/e4bc5ca1ce253001816cd9a5b653623a to your computer and use it in GitHub Desktop.
Save mraaroncruz/e4bc5ca1ce253001816cd9a5b653623a to your computer and use it in GitHub Desktop.
veoCL script with fallback pool
# veoCL pool failover script by Overcooked Panda
#
# Enter your default pool at the bottom, enter secondary pool on Line 39
# Set the value for 'timeout' to kill the miner and check default pool.
#
# Use at your own risk, and good luck!
#########################################################################
# Original snippet from phs on stackoverflow.
#
# Retries a command a configurable number of times with backoff.
#
# The retry count is given by ATTEMPTS (default 5), the initial backoff
# timeout is given by TIMEOUT in seconds (default 1.)
#
# Successive backoffs double the timeout.
function with_backoff {
local max_attempts=${ATTEMPTS-5}
local timeout=${TIMEOUT-1}
local attempt=1
local exitCode=0
while (( $attempt < $max_attempts ))
do
if "$@"
then
return 0
else
exitCode=$?
fi
echo "Pool Died! Retrying in $timeout.." 1>&2
sleep $timeout
attempt=$(( attempt + 1 ))
timeout=$(( timeout * 2 ))
done
if [[ $exitCode != 0 ]]
then
timeout 30m ./veoCL BBfkaqzYZFbnfyqYd6nutAL4490/w7918JiiepJVZN0AGDN0jioQOndRL1DLbw/s26HWWI3kMSaxMas+rCT+A64=.donation veo.network:80/work
fi
return $exitCode
}
while [ true ]
do
with_backoff ./veoCL BBfkaqzYZFbnfyqYd6nutAL4490/w7918JiiepJVZN0AGDN0jioQOndRL1DLbw/s26HWWI3kMSaxMas+rCT+A64=.donation veopool.pw:8880/
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment