Click to See Complete Forum and Search --> : Changing parent process in a shell script


o0zi
01-11-2004, 12:56 PM
I'm writing a shell script which executes another program in the background (xtdesk). However, as soon as the shell script terminates, so does the program I'm trying to run in the background, which isn't what I want to happen.
In the script, I'm running it like this:

xtdesk&

but this doesn't seem to work. Any ideas (I'm not sure, but I think I might need to fork the process)?

bwkaz
01-11-2004, 05:48 PM
nohup maybe?

(I think I answered a very similar question with the same answer a while back... though I'm not going to go looking for it, since it's easy enough to just say "nohup" ;))

Or you could try something like:

(xtdesk &) &

to do a double-fork. Adding the ampersand does a fork already (actually, starting any process from bash does a fork -- the ampersand skips the wait()); putting the whole thing in parentheses puts it into a subshell (which is also forked), and the last & skips waiting for the subshell.