zsmc: backup compression in parallel
This commit is contained in:
parent
cf9451bb1f
commit
8fa4f0dc3f
1 changed files with 6 additions and 3 deletions
9
zmc/zsmc
9
zmc/zsmc
|
|
@ -93,10 +93,13 @@ world_backup ()
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
echo "$1" | grep -q '.tar.gz$' || FILE="$FILE.tar.gz" # add .tar.gz extension if not present
|
echo "$1" | grep -q '.tar.gz$' || FILE="$FILE.tar.gz" # add .tar.gz extension if not present
|
||||||
|
|
||||||
|
gz_command=gzip
|
||||||
|
which pigz >/dev/null && gz_command=pigz
|
||||||
|
|
||||||
echo "Backing up world to $FILE"
|
echo "Backing up world to $FILE"
|
||||||
if [ -n "$(command -v pv)" ] # fancy progress bar
|
if which pv >/dev/null # fancy progress bar
|
||||||
then tar -cf - "$world" -P | pv -s "$(du -sb "$world" | awk '{print $1}')" | gzip > "$BACKUP_PATH/$FILE"
|
then tar -cf - "$world" | pv -s "$(du -sb "$world" | awk '{print $1}')" | $gz_command > "$BACKUP_PATH/$FILE"
|
||||||
else tar -cvzf "$BACKUP_PATH/$FILE" "$world"
|
else tar -cvf - "$world" | $gz_command > "$BACKUP_PATH/$FILE"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue