The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Are companies viewing my resume? How do I track my resume visits? gearyipswich What's on Your Mind? 1 04-01-2008 06:58 PM
I can't resume a process after stopping it! Nene Shell Programming and Scripting 0 08-09-2006 10:37 AM
ftp resume feature ppass SUN Solaris 2 07-30-2006 06:11 AM
resume mount connection ust UNIX for Advanced & Expert Users 2 03-31-2005 05:42 AM
continue the suspended jobs killerserv UNIX for Advanced & Expert Users 6 01-09-2002 11:09 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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 12:49 PM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-20-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 2,203
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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).
Reply With Quote
  #3 (permalink)  
Old 04-20-2008
Registered User
 

Join Date: Feb 2008
Posts: 3
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
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 01:23 AM. Reason: added code tags
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 03:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102