Allow parallel shredding of files (#167)

* to log which files were shredded
* allow parallel shredding of files ot lower time to shred
This commit is contained in:
Jon Bardin
2016-08-31 06:29:54 -07:00
committed by Tom Limoncelli
parent f108d80027
commit 4fe27a04c9

View File

@@ -21,13 +21,23 @@ source "${0%/*}/_blackbox_common.sh"
change_to_vcs_root change_to_vcs_root
echo '========== FILES BEING SHREDDED:' echo '========== FILES BEING SHREDDED:'
while IFS= read <&99 -r unencrypted_file; do
unencrypted_file=$(get_unencrypted_filename "$unencrypted_file") exported_internal_shred_file() {
source "$1/_blackbox_common.sh"
unencrypted_file=$(get_unencrypted_filename "$2")
encrypted_file=$(get_encrypted_filename "$unencrypted_file") encrypted_file=$(get_encrypted_filename "$unencrypted_file")
if [[ -f "$unencrypted_file" ]]; then if [[ -f "$unencrypted_file" ]]; then
echo " $unencrypted_file" echo " $unencrypted_file"
shred_file "$unencrypted_file" shred_file "$unencrypted_file"
fi fi
done 99<"$BB_FILES" }
export -f exported_internal_shred_file
DEREFERENCED_BIN_DIR="${0%/*}"
MAX_PARALLEL_SHRED=10
export IFS=
xargs -I{} -n 1 -P $MAX_PARALLEL_SHRED bash -c "exported_internal_shred_file $DEREFERENCED_BIN_DIR {}" $DEREFERENCED_BIN_DIR/fake <"$BB_FILES"
echo '========== DONE.' echo '========== DONE.'