stacking-sats-kraken: update to v0.3.0 (#1755)

This commit is contained in:
Dennis Reimann 2020-11-10 23:34:23 +01:00 committed by GitHub
parent 3f52fe2b4e
commit 417537eaf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,8 +7,9 @@ APP_DATA_DIR=/mnt/hdd/app-data/stacking-sats-kraken
HOME_DIR=/home/$USERNAME
CONFIG_FILE=$APP_DATA_DIR/.env
RASPIBLITZ_FILE=/mnt/hdd/raspiblitz.conf
SCRIPT_DIR=$HOME_DIR/stacking-sats-kraken
SCRIPT_NAME=stacksats.sh
SCRIPT_VERSION=0.2.0
SCRIPT_VERSION=0.3.0
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -57,6 +58,10 @@ KRAKEN_API_SECRET="privateKeyFromTheKrakenSettings"
KRAKEN_API_FIAT="USD"
KRAKEN_BUY_AMOUNT=21
# Optional settings for withdrawal
# KRAKEN_MAX_REL_FEE=0.5 # maximum fee in % that you are willing to pay
# KRAKEN_WITHDRAW_KEY="descriptionOfWithdrawalAddress"
# Optional settings for confirmation mail  requires `blitz.notify.sh on`
# KRAKEN_MAIL_SUBJECT="Sats got stacked"
# KRAKEN_MAIL_FROM_ADDRESS="humble@satstacker.org"
@ -83,12 +88,16 @@ export NODE_OPTIONS="--no-deprecation"
# load config
set -a; source /mnt/hdd/app-data/stacking-sats-kraken/.env; set +a
# switch directory
cd $(cd `dirname $0` && pwd)
# run script
cd ./stacking-sats-kraken
cmd=${1:-"stack"}
if [[ "${KRAKEN_DRY_RUN_PLACE_NO_ORDER}" ]]; then
result=$(node index.js --validate 2>&1)
result=$(npm run test:$cmd --silent 2>&1)
else
result=$(node index.js 2>&1)
result=$(npm run $cmd --silent 2>&1)
fi
echo "$result"
@ -101,8 +110,8 @@ if [[ "${KRAKEN_MAIL_SUBJECT}" && "${KRAKEN_MAIL_FROM_ADDRESS}" && "${KRAKEN_MAI
fi
' > $scriptFile
sudo mv $scriptFile $HOME_DIR/$SCRIPT_NAME
sudo chown $USERNAME:$USERNAME $HOME_DIR/$SCRIPT_NAME
sudo mv $scriptFile $SCRIPT_DIR/$SCRIPT_NAME
sudo chown $USERNAME:$USERNAME $SCRIPT_DIR/$SCRIPT_NAME
echo "OK - the STACKING-SATS-KRAKEN script is now installed."
echo ""
@ -114,7 +123,7 @@ fi
echo "STACKING-SATS-KRAKEN already installed."
fi
cron_count=$(sudo -u $USERNAME crontab -l | grep "$SCRIPT_NAME" -c)
cron_count=$(sudo -u $USERNAME crontab -l | grep "$SCRIPT_DIR/$SCRIPT_NAME" -c)
if [ "${cron_count}" = "0" ]; then
echo ""
echo "You might want to set up a cronjob to run the script in regular intervals."
@ -124,7 +133,7 @@ fi
echo ""
echo "SHELL=/bin/bash"
echo "PATH=/bin:/usr/sbin:/usr/bin:/usr/local/bin"
echo "15 6 * * * $HOME_DIR/$SCRIPT_NAME > /dev/null 2>&1"
echo "15 6 * * * $SCRIPT_DIR/$SCRIPT_NAME > /dev/null 2>&1"
fi
exit 0