Jump to content

Welcome to NulledBlog
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

How To Keep Trade Bot Connected to MYSQL


  • Please log in to reply
2 replies to this topic

#1
androidphreak

  • Offline
  • CSGOFREE.NET

  • Posts:
    42
    Reputation:
    -3
    Joined:
    15 Nov, 2015

I know some people might have come across this error before ( I did at least), where the bot would time out from the mysql database. The solution is pretty simple when you think about it.

DjxdPeh.jpg

 

Inside your trade bots script find the mysql connection code or add it as it's needed to connect to the mysql database.

var mysql = require('mysql');
var connection = mysql.createConnection({
	host     : '', // MySQL Host
	user     : '', // MySQL User
	password : '', // MySQL Password
	database : '' // MySQL Databse
});

Finally you want to add this to the bottom of your script so it checks for a connection every 5 seconds. (You can change this to pretty much any code you want that loops the connection or checks for it or w.e. I just know this gets the job done :^.)

setInterval(function () {
	connection.query('SELECT 1');
}, 5000);

Edited by androidphreak, 02 May 2016 - 11:28 PM.

  • 0

9DzzAc7.jpg


#2
ratexindex

  • Offline
  • pm2 start brain.js

  • Posts:
    208
    Reputation:
    42
    Joined:
    24 Sep, 2015

use pm2 and the bot is restarting self ;)

 

Better as nodejs

 

https://www.npmjs.com/package/pm2


  • 1

DONT MESSAGE ME PRIVATE !!! Add Spin / Roll Animation to your own Betting Site  Add new Pages in v2 + Step by Step DONT MESSAGE ME PRIVATE !!!


#3
androidphreak

  • Offline
  • CSGOFREE.NET

  • Posts:
    42
    Reputation:
    -3
    Joined:
    15 Nov, 2015

use pm2 and the bot is restarting self ;)

 

Better as nodejs

 

https://www.npmjs.com/package/pm2

Looks pretty nice from just an overview and reading about it on there site. I will download it and implement it when I can. Thank you for your contribution to this topic.

edit: Works like a charm on my windows server :^.


Edited by androidphreak, 04 May 2016 - 06:49 AM.

  • 0

9DzzAc7.jpg



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users