如何在背景中在GCP中运行VM?
我有一个GCP Linux VM,非常基本的问题:如果我有一个简单的脚本:
import time
for a in range (0,1000):
print(a)
time.sleep(10)
当我通过浏览器连接中的SSH进入控制台时,我会运行脚本,但是当我关闭窗口时,它会停止。 即使关闭电脑,我该如何使其运行?
I have a gcp linux VM, very basic question: If I have a simple script like this:
import time
for a in range (0,1000):
print(a)
time.sleep(10)
when I enter the console via ssh in browser connection I run the script, but it stops when I close the window.
How do I make it run even when I shut down my PC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用NOHUP。
例如:
然后您可以关闭会话。该脚本将继续在远程VM上运行,直到完成。
You can use nohup.
For example:
And then you may close the session. The script will keep running on the remote VM, til it finishes.