sequentially executing background processes unix
You can execute them, sequentially, like this:
(nohup S1 && nohup S2) &
Try
(echo 1 && sleep 1 && echo 2) &
The double ampersand operator is described here.
Note that when using &&
, S2
only runs if S1
finishes "successfully" (return code 0). This seems to be what you wanted. If you want S2
to run regardless of whether S1
succeeds, use ;
instead of &&
.