resume the suspended background job


 
Thread Tools Search this Thread
Operating Systems Linux resume the suspended background job
# 1  
Old 04-20-2008
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

Last edited by baloo_mia; 04-20-2008 at 04:49 PM..
# 2  
Old 04-20-2008
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:

Code:
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).
# 3  
Old 04-20-2008
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..
Code:
kill -s CONT $PID

For those who might need this command in future..

once again thanks.


best
baloo

Last edited by Yogesh Sawant; 04-21-2008 at 05:23 AM.. Reason: added code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Background job issue

How to bring a backgroud job say sample_script.sh to foreground (4 Replies)
Discussion started by: rafa_fed2
4 Replies

2. Shell Programming and Scripting

Background Job

Hello Everyody, Having a doubt. sort file1 & when we sent a job to the background it returns Job Number PID again if we want to ... (1 Reply)
Discussion started by: knroy10
1 Replies

3. Hardware

Cannot resume from suspend with new motherboardktop, does not resume properly

I would like to get pm-suspend (or any other suspend method) working for a small new desktop computer. It is based on a Zotac GF-8200 ITX motherboard and an AMD Athlon II X@ 240 CPU using ArchLinux x86_64. The pm-suspend script works, apparently putting the machine into suspend correctly... (0 Replies)
Discussion started by: lagagnon
0 Replies

4. What is on Your Mind?

Are companies viewing my resume? How do I track my resume visits?

Hi everybody, I am wondering if there is any tool or website out there which can track who is viewing my resume. It is very frustrating when you send your CV or Cover Letter and you receive no feedback from the company, you don't even know if they have checked it out. Thanks for your help (1 Reply)
Discussion started by: gearyipswich
1 Replies

5. Shell Programming and Scripting

Cannot submit a background job

Hi all, I am currently facing a problem when i am submitting a script to run in the background to collect statistics round the clock on an AIX box. I don't have root authority nor can I set it in cron. So when i submit the job, it runs fine, but won't let me signoff. It prompts me that... (2 Replies)
Discussion started by: tansha
2 Replies

6. Shell Programming and Scripting

how to get background job to foreground

hi, i am just wondering that wen we give the following code we make a process run in background...can the viceversa be performed?i.e can this be made foreground again # sleep 75& 21751 # (4 Replies)
Discussion started by: sandilya
4 Replies

7. UNIX for Dummies Questions & Answers

background job

on gnome i open a terminal and run wget http://soommmething & in the background. because wget shows me downloading progress percentage and download speed continuously, I exit the gnome-terminal after a while i want to see the download percentage but dont know how. my ps -u myname shows that... (3 Replies)
Discussion started by: babayeve
3 Replies

8. UNIX for Dummies Questions & Answers

Background job

Hiya, Recently I've run a few scripts in the foreground, but have realised later they should of been better nohup'd and placed in the background. I understand how to change a foreground job into a background one, but how would put the job into the nohup state? Thanks (1 Reply)
Discussion started by: rdbooth
1 Replies

9. UNIX for Dummies Questions & Answers

background job

I try to run a script as background job. script: #!/usr/bin/csh /usr/bin/date +20%y-%m-%d > ~/datsql.txt If I start it I got this output: tac> ./datermitteln& 293 + Stopped (SIGTTOU) ./datermitteln& I insert the following line inside my script, but without any... (3 Replies)
Discussion started by: joerg
3 Replies
Login or Register to Ask a Question