Home > Back-end >  How to see remote console of my bot at VPS?
How to see remote console of my bot at VPS?

Time:05-21

I have my discord bot, and i hosted it at VPS. I writing my js scripts for bot (node.js) via VS Code, and I have “Remote SSH” plugin for applying changes immediately. I have ftp and ssh options for connect to my VPS.

But I have next issue: When I’m coding, I open VS Code, connecting to my server, after I have finish my changes I start command “forever start index.js” (it’s need for bot will be always online), I’m closing VS Code. Bot working perfectly. But when I open VS Code again, and connecting via “Remote SSH” plugin, I can make a change in my scripts, but I don’t see anything in console( only one solution what I found is: stop my bot, then just start by “node index.js”), and when I will finish coding press “ctrl c”, then type “forever start index.js” But it’s bad for me, cz my bot has some timeout tasks and other stuffs(

I mean: I see any “console.log()” messages only when I open vscode, then typing “forever stop index.js”, then type “node index.js”.. but I can’t see anything in console if I close vscode and open again( looks like bot wanna stay alive without me..

I don’t see any message in console when I connecting to already working bot.

How I can see console of my already working bot on VPS without restarting?

CodePudding user response:

When starting your program with forever, there's options to log information to a specified file.

From here

-l  LOGFILE      Logs the forever output to LOGFILE
-o  OUTFILE      Logs stdout from child script to OUTFILE
-e  ERRFILE      Logs stderr from child script to ERRFILE

For example, you can start your bot like this

forever start -l logs.txt my-script.js
  • Related