0

I'm very new to all of this, so please tell me anything I'm doing wrong!

I wrote a little bot for Discord using Node.js.

I also signed up for the free trial of Google Cloud Platform wth $300 of credit and all that. After creating a project, I started the cloud shell and ran my Node.js Discord bot using:

node my_app_here.js

The cloud shell is running and the bot is working correctly. Will the cloud shell run indefinitely and keep my bot running? It seems hard to believe that Google would host my bot for free. I have billing disabled on the project, but I'm afraid of getting hit with a huge bill.

Thanks for any help or recommendations!

Hayden Hong
  • 135
  • 1
  • 9
  • yes its free, it only lives while the shell is open and has very low ram and power. also its ip will change every time. – Zig Mandel Jun 09 '17 at 04:18

2 Answers2

1

It is free but intended for interactive usage. I guess you could get away with using it for other purposes but it would probably be a hassle. If you want to go free you could consider if what you try to do would fit into the free tier on google app engine standard environment.

Cloud Shell is intended for interactive use only. Non-interactive sessions will be ended automatically after a warning. Prolonged usage or computational or network intensive processes are not supported and may result in session termination without a warning.

Documentation

Arne S
  • 1,004
  • 14
  • 41
0

Your could use this code at the end of your code to keep it alive:

function intervalFunc() {
  const { exec } = require("child_process");

exec("ls -la", (error, stdout, stderr) => {
    if (error) {
        console.log(`error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }     
},)}

setInterval(intervalFunc, 3600000 )});