Skip to content

Instantly share code, notes, and snippets.

@anroopak
Created January 18, 2019 05:58
Show Gist options
  • Save anroopak/084cc913d2c701c30c228314c0f01f06 to your computer and use it in GitHub Desktop.
Save anroopak/084cc913d2c701c30c228314c0f01f06 to your computer and use it in GitHub Desktop.
Running Jobs in Parallel
# Runs the run_job function in parallel
run_job() {
/path/to/script.ext <args(optional)> $1 > "logs/$1.log" 2>&1
}
export -f run_job
# limits.txt file has the args for the run_job function.
# -j4 => run 4 threads at max in parallel
# --eta => print the eta of the jobs on the console
cat limits.txt | parallel -j4 --eta run_job {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment