resume the suspended background job

Hi,

I was running a job in background and because of some immediate work to be done on my machine, I stopped the background job. The real problem comes when I try to restart the same job in the background. To stop I used
stop PID

and to resume the same I use
bg PID

when I do this the system says "bg: No such job". Even the job PID is there with stat 'T'. The job has been started from one terminal and has been stopped in another terminal but now I want to restart with some other terminal and it does not work with the PID.

Does anyone come across this kind of problem. Please suggest the solution.

Best
Baloo

fg and bg use job identifiers, not PIDs (that's why it says "no such job" -- you probably don't have like 20742 jobs in that shell). If you know the PID, you can send it a CONT signal:

kill -s SIGCONT $PID

Maybe try this on a harmess "sleep 600" before axing a process you want to keep, just to be on the safe side.

You can't reconnect it to another terminal than the one it was started in. It will continue to run on the terminal where you started it (or possibly terminate or crash if that terminal is no longer available).

Thanks for the prompt reply and making clear the concept associated with stop and bg.

I tried running some dummy job on first terminal and then 'stop' in second terminal using PID and finally using third terminal to restart the background suspended job same PID and it worked the command I used was..

kill -s CONT $PID

For those who might need this command in future..

once again thanks.

best
baloo