An easier way would be to use the nohup command. This allows you to start a process and mask the SIGHUP signal in one command. Once started, all output from the program is piped to a file rather then stdout. I've used this for starting scripts that i want left running after i log out. It works pretty well.
On 7/5/07, Peter McNabb <[EMAIL PROTECTED]> wrote: > > > On Jul 5, 2007, at 12:36 PM, Stuart Jansen wrote: > > > Eduardo Sanz-Garcia wrote: > >> I found the following weird behavior with my terminal: > >> 1- I start a new terminal window. > >> 2- I start a background job in the newly open terminal window. > >> 3- When I quit the terminal window the background job is also > >> killed. > >> > >> How can I resolve that problem? > > When I parent dies, it's children are killed. You need to detach the > > child from the parent. For services (daemons) like Web servers there's > > usually an option to tell it detach. If the program doesn't support > > detaching, you could use nohup or screen. > > Definitely look into screen, but I think you're looking for something > as simple as "disown." You can specify a job to not receive a sighup > when the shell gets one, or completely disassociate the process with > the shell. I know bash has this, but I'm not as familiar with other > shells. > > Basically: > $ sleep 60 & > [1] 29481 > $ jobs > [1]+ Running sleep 60 & > $ disown > $ jobs > $ ps auxww | grep sleep > peter 29481 0.0 0.0 27244 340 p2 S 1:41PM 0:00.01 > sleep 60 > > See more here: > http://www.faqs.org/docs/bashman/bashref_79.html > > -peter > -------------------- > BYU Unix Users Group > http://uug.byu.edu/ > > The opinions expressed in this message are the responsibility of their > author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. > ___________________________________________________________________ > List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list > -------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
