I have a task flow which can be divided into step_1 and step_2, both running in bash. step_1 needs run a bash script in folder_a. when I submit my jobs into multiple hosts, there are multiple threads which will trigger the bash script in folder_a, this will break the function.
I want my jobs run as following :
- every job's step_1 has to run one by one, otherwise it will break function in the folder_a.
- every job's step_2 can run parallelly for speed.
How to lock the folder if the bash in folder_a is running and refuse to run for other thread ? Maybe I can only lock the step_1 bash top script inside folder_a, instead of the folder.