From 4848fd64ac6dee7198690c9e17c26b1ba9a88e58 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Wed, 8 Jul 2020 16:32:51 +0700 Subject: [PATCH] Make the polling time customizable, and document how to customize it --- README.md | 1 + switch.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d2dc01..2057958 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,4 @@ Other than that everything should be in the default paths. - JSONRPCURL (Default: http://10.254.2.2:8332) : Is the JSON-RPC interface for bitcoind - LND_CONTAINER_NAME (Default: lnd) : is the container name to restart +- SLEEPTIME (Default: 3600) : Configures how often to poll. Ideally we should set this high so we minimize disruptions, but we might want to set it lower for testing. diff --git a/switch.sh b/switch.sh index cd74b9e..14224f2 100755 --- a/switch.sh +++ b/switch.sh @@ -17,6 +17,11 @@ # Then PASSWORD=`cat /secrets/rpcpass.txt` +# If sleeptime isn't set, set it to 3600 (1 hour) +if [ -z $SLEEPTIME ]; then + SLEEPTIME=3600 +fi + # If JSONRPCURL doesn't exist then set it if [ -z $JSONRPCURL ]; then JSONRPCURL="http://10.254.2.2:8332" @@ -83,6 +88,6 @@ while true; do #TODO: Lets maybe try to switch back fi - # Run every every 1 hour - sleep 3600 + # Run every every 1 hour by default or as per configurable + sleep $SLEEPTIME done