Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if ! [ -x "$(command -v pigz)" ]; then
- echo >&2 "I require pigz but it's not installed. Aborting."
- exit 1
- fi
- if [ "$#" -eq "2" ]; then
- dt=$(date --iso-8601)
- threads=$(nproc --all)
- filename="${1}_${dt}.tar.gz"
- echo "[$0] Compressing ${@:2} into ${filename}"
- tar cf - ${@:2} | pigz -9 -p "${threads}" > "${filename}"
- else
- echo "[$0] Usage: $0 compressed_file_name files_or_dir_to_be_compressed"
- fi
Advertisement
Add Comment
Please, Sign In to add comment