Username: Password:

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - shacky

Pages: [1]
1
hi

little improvement and compatibility with 3.x release :


change the grep command line to grep -qw (because pair like STR won't launch if pair STRAT is already running so the -w flag force a whole word match)

Code: [Select]
#!/bin/bash
########### EDIT PLEASE ###############
# exact folder where gunbot and config files are
botfolder="/home/user/gunbot"
########## NO MORE EDIT ###############

############## DONT EDIT ##############
_dfiles="*-config.js"
red=`tput bold setaf 1`
green=`tput bold setaf 2`
blue=`tput bold setaf 4`
reset=`tput sgr0`
for f in $_dfiles
do
_name="${f##*/}"
_namef="${f%-*}"
echo "Checking if pair  $_namef is running..."
  if ! screen -list | grep -qw "$_namef"; then
  echo "${red}Pair not running.... ${green}Starting $_namef pair... ${reset}"
  screen -dmS $_namef
  screen -S $_namef -p 0 -X exec node $botfolder/index $_namef poloniex
  echo "Waiting 5S"
  sleep 1
  echo -n "...1"
  sleep 1
  echo -n "...2"
  sleep 1
  echo -n "...3"
  sleep 1
  echo -n "...4"
  sleep 1
  echo "${blue}...5!${reset}"
  echo "${green}Next PAIR${reset}"
  else
  echo "${green}Pair $_namef RUNNING${reset}"
  sleep 0.2
  fi

done

Thanks for your suggestion! Will edit the main topic to add it.

Thanks.

2
This scripts work for you, if you have two polo accounts in two folders without problem. You should change only;

                screen -dmS $_namef to screen -dmS $_namef-2dary
if ! screen -list | grep -qw "$_namef"; then to if ! screen -list | grep -qw "$_namef-2dary"; then

I suggets to you, to have one script for each folder and everything will work.

3
Beginners & Help / Re: [TUT] How to running GUNBOT in Linux
« on: April 21, 2017, 07:15:37 AM »
control + c to stop de pm2 monit

4
Hi everyone,

Today I did a bash script to help me start all the pairs in Linux  (one in each screen) with a time delay of 5 seg for each pair. The script check if the screen exist to reduce the risk to start a duplicate pair.

The script will search for all config files in the gunbot folder and will try to start each one.

How to setup:

1) create a file in the gunbot folder with whatever name you want but the extension should be .sh, for example:
Code: [Select]
nano start_gunbot.sh2) Copy the code to the file
Code: [Select]
#!/bin/bash
########### EDIT PLEASE ###############
# exact folder where gunbot and config files are
botfolder="/root/bot/gunbotv2.0.4"
########## NO MORE EDIT ###############

############## DONT EDIT ##############
_dfiles="*-config.js"
red=`tput bold setaf 1`
green=`tput bold setaf 2`
blue=`tput bold setaf 4`
reset=`tput sgr0`
for f in $_dfiles
do
_name="${f##*/}"
_namef="${f%-*}"
echo "Checking if pair  $_namef is running..."
  if ! screen -list | grep -q "$_namef"; then
echo "${red}Pair not running.... ${green}Starting $_namef pair... ${reset}"
screen -dmS $_namef
screen -S $_namef -p 0 -X exec $botfolder/gunbot $_namef
echo "Waiting 5S"
sleep 1
echo -n "...1"
sleep 1
echo -n "...2"
sleep 1
echo -n "...3"
sleep 1
echo -n "...4"
sleep 1
echo "${blue}...5!${reset}"
echo "${green}Next PAIR${reset}"
  else
echo "${green}Pair $_namef RUNNING${reset}"
sleep 0.2
  fi

done
3)Make sure you edit the botfolder variable to the exact folder your bot is installed.
4) control + o to save and control + x to exit
5) make in executable:
Code: [Select]
chmod u+x start_gunbot.sh6) execute the script
Code: [Select]
./start_gunbot.sh
The script will search for all files with the name XXX_XXX-config.js and will execute the bot with that configuration in a screen called with the name of the pair.

Remember that:
- You should have only the config files you want to run in the gunbot folder, because the script will start ALL the pairs with config files in that directory. If you don't want to run a individual pair, move the config file.
- This only works with gunbot strategy, not 1000 strategy. It's easy to modify for that strategy.
- Dont call this script if you already running the bot. To run this script please stop all your robot sessions.
- Works with all Linux distributions.

If you want to see the output of each pair, you should execute:
Code: [Select]
screen -ls
and when you find the pair you want to see the output, only call the screen:
Code: [Select]
screen -r PAIR_NAME
To exit of the screen without closing it, press:
control a + d

I have another script to stop all trading, here is the code:

Code: [Select]
#!/bin/bash
############## DONT EDIT ##############
_dfiles="*-config.js"
red=`tput bold setaf 1`
green=`tput bold setaf 2`
blue=`tput bold setaf 4`
reset=`tput sgr0`
for f in $_dfiles
do
_name="${f##*/}"
_namef="${f%-*}"
echo "Checking if pair  $_namef is running..."
  if ! screen -list | grep -q "$_namef"; then
        echo "${blue}Pair not running.... ${reset}"
  else
        echo "${red}Pair $_namef RUNNING${reset}"
        screen -S $_namef -X quit
        echo "${blue}EXITING...${reset}"
        sleep 0.2
  fi

done

This code will close all the screen running with the name of the pairs listed in the gunbot folder.

If anyone want help, let me know,

If this helps you, give me a beer:

1Hoy4BgkHQg8wGzskwcVbxhcEcRscMFRnW

Thanks.

Pages: [1]