running scripts parallely and sequentially unix
I have the following requirement where there are 3 scripts say, a2,a3,a4
Now as per the requirement a2,a3 should be executed parallely and a4 sequentially.(ie., a4 should be executed only after the completion of a2&a3).
Now I tried this like,
((((echo 'start a2' `date`; nohup a2; echo 'end a2') >>log) &)
(((echo 'start a3'; nohup a3; echo 'end a3') >>log) &) &&
(echo 'start a4';nohup a4; echo 'end a4') >>log)
assuming a2,a3 are send to the background by the '&' and a4 executes only after a2,a3 because of '&&' why doesn't this work?.(a4 executes before a3.I tried this by introducing delays in the scripts with sleep command) How should I go about 开发者_开发知识库writing this?. Thanks in advance.
You need to wait for a2 and a3 to complete before you run a4. So look at the manual page for the wait command.
加载中,请稍侯......
精彩评论