![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to make a parent wait on a child shells running in background? | albertashish | UNIX for Advanced & Expert Users | 1 | 08-01-2008 10:13 AM |
| How to know the status of process running in background | sumanta | Shell Programming and Scripting | 8 | 03-04-2008 02:03 AM |
| running process in background | kingdbag | UNIX for Dummies Questions & Answers | 3 | 11-10-2006 09:34 AM |
| how to get background job to foreground | sandilya | Shell Programming and Scripting | 4 | 02-02-2006 08:29 AM |
| set background/foreground color in .profile | dvella | UNIX for Dummies Questions & Answers | 3 | 08-14-2005 04:12 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
make a foreground running process to run background without hang up
I've tried this a long time ago and was successful but could not remember how i did it. Tried ctrl+Z and then used bg %
could not figure what i did after to keep it no hangup - not sure if used nohup -p pid, can u plz help me out if this can be done. Any help will be appreciated. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
To place a foreground process in the background: suspend the foreground process (with Ctrl-z) then enter the bg command to move the process into the background.
Show the status of all background and suspended jobs: jobs Bring a job back into the foreground: fg %jobnumber Bring a job back into the background: bg %jobnumber Regards |
|
#3
|
|||
|
|||
|
Depends on the shell whether bg jobs will receive a HUP when you log out; I believe with bash they will not.
|
|
#4
|
|||
|
|||
|
i'm working on a korn shell, but my script is running on bash mode, will it affect ?
|
|
#5
|
||||
|
||||
|
nohup
You can run your command with `nohup' - this will cause it to ignore all input and send its stdout (and stderr?) to the file "nohup.out" in your cwd. After you've run your command, you can background it as normal (^Z bg) but it will continue to run after you sever the terminal connection.
Depending on your shell (bash for sure, others maybe) you can also use the "disown" command on a job to disconnect it from the controlling terminal. |
|
#6
|
|||
|
|||
|
When you have already started the job you can use "nohup <pid>" to unattach it from the terminal you are on (this is the reason why processes stop when you log off - they are attached to a terminal and this terminal ceases to exist when you log off) so they won't stop when you log off.
Therefore: Code:
$ job # starts the job $ <CTRL-Z> # stops the job $ bg # puts the job in background $ nohup <PID> # unattaches the backgrounded job from the terminal bakunin |
|
#7
|
|||
|
|||
|
I had never heard of nohup PID and it does not seem to be supported by GNU coreutils nohup, so I guess it's not portable. But if it works for you, good.
|
|||
| Google The UNIX and Linux Forums |
| Tags |
| background, foreground, job control, nohup |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|