运行 python 服务器上的 python 脚本并连接到服务器并与脚本交互

Running a python script on a ubuntu server and connect to server and interact with script

我不确定如何处理这个项目,但我的目标是在云中的 ubuntu 服务器上不断 运行 有一个 python 脚本,然后能够连接到我的服务器通过 ssh 然后能够与 运行 的 python 脚本交互,但我不确定从哪里开始。

建立ssh连接后使用screentmux

安装tmux(通常默认安装)以防万一:

sudo apt install tmux

他们运行tmux

在 tmux 会话中,您可以 运行 脚本并与之交互。 每当您断开连接时;该脚本将继续工作。

在 re-establishing ssh 连接后,您可以 tmux at 并继续使用您的脚本并检查其日志。 有关 tmux 的更多信息,请查看 this link.