-1

Using many bash parallel processes:

process1 &
...
process30 &

Doing multiple git operations within each process randomly will produce:

 fork: Cannot allocate memory

The system is CentOS 7 with no swap, I'd like to be able to wait to spin up the next process until it is safe to. What would be the best way to do this?

0
1

Like you executed, it will start all the processes in paralell, putting them in the background. That's what the ampersand (&) does.

In that case, run the commands in sequence, i. e., one after the other.

To do that, separate each process with a semicolon (;) or in new lines, without the final ampersand, like this:

process1; process2; ... ; process30

or

process1
...
process30

Like this, it will start process1, and when it ends will start process2, and when process2 ends, it will start process3, and so on, until process30.

If you only want to run the next command if the current one doesn't fail, then separate the commands with two ampersands (&&), like this:

process1 && process2 && ... && process30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.