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
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.
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:
$ job # starts the job
$ <CTRL-Z> # stops the job
$ bg # puts the job in background
$ nohup <PID> # unattaches the backgrounded job from the terminal
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.
a useful addition to command nohup for Solaris users, but as era says, not usable (so far) in Linux -- nor aix, nor hp-ux, nor freebsd, etc. ... cheers, drl
on AIX UNIX ksh it work use it:
press (ctrl+z ) to stop that job
then run (jobs) it who id of stoped job_id
the for running that job in foreground use(fg %<job_id>)
the for running that job in background use(bg %<job_id>)
and to start it in nohup use (nohup `bg %<job_id>`)
$ jobs
$ version =o
aix 5.1
$ jobs
$ sleep 100 &
[1] 30552
$ nohup -p $!
Sending nohup output to nohup.out.
nohup: -p: A file or directory in the path name does not exist.
$ echo $!
30552
What version of aix are you using? ... cheers, drl
Still, i have seen in the meantime, while sifting through older documentation, that "-p" is nonstandard. I have never needed it until recently, when i looked it up and found that option - so i took it for granted, unaware that it is not as common as i thought.
i face the same problem with the nohup commnad,anyway if you want the nohup to run
successfully dont use the ctrl + Z,just close the telnet window and go out the system
login to the system again and you can see that your program is working
nohup /usr/bin/ksh <xxx>.sh
i try it on tru UNIX V4.0F and it works