Username: Password:

Author Topic: Script: Startup new pair from template on Linux  (Read 11535 times)

Offline dynotune

  • Rookie
  • *
  • Posts: 1
    • View Profile
Script: Startup new pair from template on Linux
« on: September 10, 2017, 06:50:54 PM »
I was getting tired of copy/editing config files, so I made a template, then wrote this simple little BASH script to copy the template, add the pair you requested, and start it up. If there's already a config file, it will just start it.

I didn't see any other scripts like this, so I thought I'd share. Feel free to add/change/share/ignore. :) Only tested on bittrex as that's all I'm using with gunbot at the moment.

Copy this into a new file in the same directory as your gunbot install, I named it startup_pair.sh
Then after that run chmod 755 startup_pair.sh and you can run it (in a screen session if you wish) with ./startup_pair.sh XRP or whatever minor to bitcoin pair you like. Currently only supports BTC_xxx
You can change the script with the exchange, template file, template minor pair keyword, etc.

Code: [Select]
#!/bin/bash

EXCHANGE=bittrex
TEMPLATE=bittrex-BTC_TMPL-config.js
KEYWORD=XXX

# Test to see if the right coin pair exchange config exists,
# if not, make one from your template
if [[ ! -e $EXCHANGE-BTC_$1-config.js ]]
then
  cat $TEMPLATE | sed s/$KEYWORD/$1/g >$EXCHANGE-BTC_$1-config.js
fi

# Start up the client with your pair and exchange
./gunthy-linuxx64 BTC_$1 bittrex