Skip to content

Instantly share code, notes, and snippets.

@rjurney
Last active March 29, 2020 21:43
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 rjurney/0003cab7dc6980c724265b6244aaa87a to your computer and use it in GitHub Desktop.
Save rjurney/0003cab7dc6980c724265b6244aaa87a to your computer and use it in GitHub Desktop.
How to occupy 64 cores with bzip2 validating files if you're a MORON :)
#!/bin/bash
for year in 2017 2018 2019 2020
do
for months in 01_02 03_04 05_06 07_08 09_10 11_12
do
month1=$(echo "${months}" | cut -d '_' -f1)
month2=$(echo "${months}" | cut -d '_' -f2)
# 30 days x 2 is around 64 pids
for month in ${month1} ${month2}
do
echo "Doing month ${year}-${month} ..."
for day in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
do
# Now do all the files in that day group in the background
bzip2 -t ./${year}-${month}-${day}*.json.bz2 2>&1 | egrep '^bzip2' >> ${PROJECT_ROOT}/logs/github_validate.log &
done
done
# Perform some redundant work to slow things down
bzip2 -t ./${year}-${month}-28*.json.bz2 2>&1
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment