问题描述
我需要制作静态网站.所以我通过 ssh 连接到一些本地服务器,我想在那里制作一个静态网站.然后我用 python 让它工作:
I need to make static website. So I connected via ssh to some local server, where I want to make a static website. Then I used python to make it work:
$ python -m http.server 55550
但是如果我关闭终端,那么 python 程序就会终止.我想关闭我的电脑,但我想让这个进程在那个本地服务器上运行,这样其他人仍然可以访问那个网站.
But if I close terminal, then python program is terminated. I want to shut down my computer, but I want to let this process running on that local server, so other people could still access that website.
我该怎么做?之后,我应该如何终止该进程?
How can I do this? After that, how should I terminate that process later?
感谢您的帮助
推荐答案
Use the nohup
shell builtin:
nohup python -m http.server 55550
要终止进程,只需使用 kill
命令杀死它,就像任何其他进程一样.
To terminate the process, simply kill it using the kill
command, just like any other process.
这篇关于在终端中运行 python 并且在终端关闭时不终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!