Running two processes in background

hi there,

here's what i need in my korn-shell:

... begin korn-shell script

... nohup process_A.ksh ; nohup process_B.ksh &

... "other stuff"

... end lorn-shell script

in plain english i want process A and process B to run in the background so that the script can continue doing "other stuff".

but i want process B to follow process A (not run simaltaneously) i.e. B should start only after A is done. is there a simple elegant way to do this ?

thanks
jacob

have you tried:

nohup process_A.ksh & && nohup process_B.ksh &

hi Cameron,

i got the following error message (the && doesn't seem to work)

ksh: syntax error: `&&' unexpected

still, thanks for replying. do you know of any other possibilities i might want to check ?

jacob

just to pre-empt the following solution:

one easy way to solve this would be have "nohup process_B.ksh" as the last line in process_A.ksh.

however, this is for a automation/scheduler piece that i am trying to write and process_A is any system user's process, while process_B is a sort of cleanup process done by the scheduler module. in the interest of keeping things unchanged for the eventual users - i don't want users to have to modify all their "process_A"s to include a line for process_B.

just in case, someone came up with the above solution

thanks
jacob

A bit of quick reading ...

Try: (nohup process_A.ksh; nohup process_B.ksh)&

I am a little worried about this. The parentheses create a subshell and the ampersand puts this subshell into the background. The subshell then uses nohup to run the first process and then it uses nohup to run the second process. The problem is that the subshell itself is not nohup'ed.

I think that
nohup sh -c "( A ; B )" &
will avoid this problem.

hi Perderabo,

great solution ! works just like i wanted it to.

Perderabo - you were right about the subshell not being nohup'ed

Cameron - thanks for initiating the solution-thought. greatly appreciated.

thanks folks
jacob