Skip to content

Instantly share code, notes, and snippets.

@likewinter
Last active October 31, 2022 11:07
Show Gist options
  • Save likewinter/d95357651e7be0396cc33a9457e41167 to your computer and use it in GitHub Desktop.
Save likewinter/d95357651e7be0396cc33a9457e41167 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
START_ID=2935172
LIMIT=1000
COMMAND=$1
PARALLEL=$2
TOTAL=$(( (PARALLEL - 1) * LIMIT ))
function gen() {
for offset in $(seq 0 $LIMIT $TOTAL); do
echo "$COMMAND $START_ID $offset $LIMIT > ./logs/$offset.log";
done
}
gen | xargs -L 1 -P "$PARALLEL" -I {} sh -c "{}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment