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

I am not sure how to approach this project but my goal is to have a python script constantly running on a ubuntu server in the cloud then being able to connect to my server via ssh and then being able to interact with the python script that is running but i am not sure where to start.



Solution 1:[1]

use screen or tmux after establishing ssh connection.

Install tmux (it is usually installed by default) just in case:

sudo apt install tmux

them run tmux

Inside the tmux session, you can run the script and interact with it. Whenever you got disconnected; the script will continue working.

After re-establishing ssh connection you can do tmux at and continue working with your script and check its log. For more information on tmux check out this link.

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