Update rclone.sh

This commit is contained in:
2018-01-18 12:15:35 -05:00
parent 6fcd0b0071
commit 95380a96b9

View File

@@ -26,15 +26,17 @@ function gzipVMbackups {
# loop through VM backups and tar/gzip them to single file
for dir in /mnt/data-pool/esxi/backups/*/*/; do
# get the folder name of the backup
base=$(basename "${dir}")
# had to cd into the directoy since tar -C $dir was not working for me with relative path
cd ${dir%/*/}
# create the tar and pipe into pigz for multi-threaded gzip
tar cf - "${base}" | pigz > "${dir%/}.gz"
# if the tar/gzip was successful, delete the backup directory
if [ $? -eq 0 ] && [ -f "${dir%/}.gz" ]; then
rm -rf "${dir}"
if [ ! -z "$dir" ];
# get the folder name of the backup
base=$(basename "${dir}")
# had to cd into the directoy since tar -C $dir was not working for me with relative path
cd "${dir%/*/}"
# create the tar and pipe into pigz for multi-threaded gzip
tar cf - "${base}" | pigz > "${dir%/}.gz"
# if the tar/gzip was successful, delete the backup directory
if [ $? -eq 0 ] && [ -f "${dir%/}.gz" ]; then
rm -rf "${dir}"
fi
fi
done
}