Update rclone.sh
This commit is contained in:
20
rclone.sh
20
rclone.sh
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user