I have a python
script to run a flask application in ubuntu server
.
I ssh'ed to the system and ran the flask server with python run.py
in debug mode
, to see the debug info.
app.run(host='0.0.0.0',port=5000,debug=True)
Somehow I got disconnected to the session as I came to my home network , and when I ssh'ed again I could see that the script is still running( not sure if saying running in background would be correct ).
ubuntu@ip-11-11-11-11:~$ ps -aux | grep python
root 800 0.0 1.4 170820 15096 ? Ssl May02 0:00 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
root 858 0.0 1.5 187636 16100 ? Ssl May02 0:00 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal
ubuntu 13069 0.0 2.1 58744 21408 pts/1 S+ 10:20 0:00 python webhook.py
ubuntu 13071 0.2 2.2 213440 22876 pts/1 Sl+ 10:20 0:22 /usr/bin/python /home/ubuntu/webhook.py
ubuntu 13380 0.0 0.1 13136 1008 pts/0 S+ 13:13 0:00 grep --color=auto python
and the port number associated with the flask server is open as well.
ubuntu@ip-11-11-11-11:~$ netstat -tunapl | grep LISTEN
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5000 0.0.0.0:* LISTEN 13069/python
tcp6 0 0 :::22 :::* LISTEN -
I wanted to see the debug info again , so I thought to use fg
to bring it into foreground. but there is no output for jobs
.
ubuntu@ip-11-11-11-11:~$ jobs
ubuntu@ip-11-11-11-11:~$
I believe it means that python script is a process not job.
Can someone please help me with this , Is there any way I can bring the python script back in the command line. Thanks in Advance.