Skip to content

Instantly share code, notes, and snippets.

@FabienArcellier
Created August 8, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienArcellier/3f8888a8a9323bb1f8bd9c94e95072dd to your computer and use it in GitHub Desktop.
Save FabienArcellier/3f8888a8a9323bb1f8bd9c94e95072dd to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
readonly SCRIPT_DIR=$(dirname $(readlink -m $0));
function main
{
if [ -z "$1" ] && [ -z "${2}" ]; then
error_exit "Argument Identifiant projet attentu : bash ${0} path"
fi
set -o errexit
set -o pipefail
set -o nounset
set -o errtrace
local path=$1
local files=$(find $path -name "*.html")
NPROC=0
for f in $files; do
# execute my commands here
# python script.py
NPROC=$(($NPROC+1))
if [ "$NPROC" -ge 10 ]; then
wait
NPROC=0
fi
done
}
function error_exit
{
echo "$1" 1>&2
exit 1
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment