I am working on CentOS6, and running a django server for my development on a tmux session as:
python manage.py runserver 0.0.0.0:8000
So I can read my debug string print on it.
While there is an unknown reason which made my tmux session lost, and I cannot to bak to my working session using "tmux attach" command.
I still can find my server is running by ps command, but I have no permission to kill this in order to run a new server on the same port.
So, I want to call this backgound server to frontgound again.
As I never use ctrl+z or other ways to take process background, so even I use jobs command, there are no jobs.
But I dont know if I can do this, and how to do this...
Thanks all!!
We can reconnect a background job to our terminal with the Linux command fg. This command will bring job 2 into the foreground. If no job ID is given, fg will assume we're referring to the current (suspended) job.
While hold Alt, tap Tab once and then mouse-click on the one you're interested in. It will come to the front.
You can use the jobs command to list the jobs that are currently running or suspended in the background. You can use the fg command to bring a background job to the foreground. Note: The foreground job occupies the shell until the job is completed, suspended, or stopped and placed into the background.
Use the jobs
command to find the list of background processes that are started by you.
for eg: there is script which simply sleeps for 10 secs in 5 iterations.I ran it 4 times in the background.
>jobs
[1] + Running ./temp.sh
[2] - Running ./temp.sh
[3] Running ./temp.sh
[4] Running ./temp.sh
fg
is the command to bring it back to the foreground as shown below.
>fg 1
[CTRL -c]
as seen above i have ended the process and it no longer exists.
now if i again run jobs
>jobs
[2] + Running ./temp.sh
[3] Running ./temp.sh
[4] - Running ./temp.sh
>
Also you can check here for more
You can use the command jobs
to obtain a list of your jobs, then you can use fg <number of job>
to bring that job to the front.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With