Communicate to a running process ubuntu python server

Viewed 36

I'm running a Ubuntu server on Azure's cloud. I run the command nohup python3 scanner.py to allow me to run my script and close the putty terminal and let it keep running. The problem is now I have no way to give input to the process, and if I want to terminate it I have to use the kill command.

What's the best way to disconnect/connect to a running process on ubuntu server command line

1 Answers

There are a couple of ways, but none are particularly fantastic. First, you could rework the script such that it has some form of socket connection, and expects input on that, and then write yet another script to send information to that socket. This is very work-heavy, but I've done it before. Second, you could use something like screen or tmux instead of nohup so that you can reconnect to that terminal session later, and have direct access to stdout/stdin.

Related