Created
August 8, 2016 14:55
-
-
Save FabienArcellier/3f8888a8a9323bb1f8bd9c94e95072dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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