Operating System - HP-UX
1753882 Members
7531 Online
108809 Solutions
New Discussion юеВ

Re: How to set a ruuning process to run in the background

 
rana786
Regular Advisor

How to set a ruuning process to run in the background

Hi all,

I want to run a process in the background which had already been started before. Since the process may take a long time to be completed so I want to let the process run in the background and want to leave office closing my laptop. Can anyone help me providing the commands that I need to apply in this situation?

Rgds,
Mostafa
Walker_dhk
5 REPLIES 5
RAC_1
Honored Contributor

Re: How to set a ruuning process to run in the background

Are you referring to unix process? Depending upon your stty settings, you can suspend a process and then push it into back ground using bg command.

man stty and man sh-posix
There is no substitute to HARDWORK
rana786
Regular Advisor

Re: How to set a ruuning process to run in the background

Hi
It is rp7420 ux 11.11 running oracle 9i. What I want to do is to send a running process in the background.

Rgds,
Mostafa
Walker_dhk
RAC_1
Honored Contributor

Re: How to set a ruuning process to run in the background

Open another terminal and do stty -a. Check out what key combination you have for susp. Press it. (mostly should be cntr+Z)
then push that job into back ground using following command

bg "job_number" (while suspending, it will give you job number)
There is no substitute to HARDWORK
Deepak Kulkarni
Regular Advisor

Re: How to set a ruuning process to run in the background

Hi,

You can it by two ways one is mentioned above and another is `nohup` command.


Cheers
Deepak
Bill Hassell
Honored Contributor

Re: How to set a ruuning process to run in the background

Just to clarify: for an existing, running process, only the bg command will work to place the process into the background. The nohup does not place a process into the backgraound but is a process 'protector'. It's job is to absorb the hangup signal (HUP) sent by the shell when you logout. You want the background process to continue running even after you logout, so nohup becomes the parent when you use it like this:

nohup some_process optional_params &

Note that & places the process into the background, and nohup protects the process so it isn't killed when your shell logs out.

Note that the nohup ... & construct is what you will need to do. There is no way to protect an alfreaqdy running process from your shell's exit. You can test all this with the sleep command:

sleep 999 &

Now exit (you'll have to type exit twice) then see if sleep is still running (it won't be). Now protect it:

nohup sleep 999 &

and now you can exit and sleep will still be running.


Bill Hassell, sysadmin