'Run program in Google Cloud Shell even if session terminates

I have a C++ program that takes hours to run, and I would like to run it in the Cloud.

I've tried running it in Google Cloud Shell, but when the connection is lost, the execution is stopped. I tried using "nohup ./exefilename &" but it didn't work.

I'm sure there should be a cheap and easy way to solve this. Many thanks in advance!



Solution 1:[1]

In my case, I had to run the node js server permanently.
I tried "nohup yarn start > /dev/null &" but the app(node js server) was closed when SSH was disconnected.
Next, I tried "sudo su" and then executed "nohup yarn start > /dev/null &". It worked for me. Hope this is helpful.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ZhefengJin