look at local volumes too
This commit is contained in:
@@ -52,16 +52,22 @@ for key in $keys; do
|
||||
volume_name="rpc_$key"
|
||||
|
||||
newest_file=$(ls -1 "$backup_dir"/"$volume_name"* | sort | tail -n 1)
|
||||
directory="$volume_dir/rpc_$key/_data/"
|
||||
[ -d "$directory" ] && existing_size=$(du -sb "$directory" | awk '{ total += $1 } END { print total }') || existing_size=0
|
||||
|
||||
if [ -z "$newest_file" ]; then
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
if [[ "$2" = "--print-size-only" && $existing_size -gt 0 ]]; then
|
||||
# I only want to have a theoretical file size
|
||||
GB=$(echo "$existing_size / 1024 / 1024 / 1024" | bc )
|
||||
echo "$GB"
|
||||
exit 0
|
||||
else
|
||||
echo "Error: No backup found for volume '$volume_name'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
directory="$volume_dir/rpc_$key/_data/"
|
||||
restore_files+=("$newest_file")
|
||||
cleanup_folders+=("$directory")
|
||||
|
||||
@@ -69,7 +75,7 @@ for key in $keys; do
|
||||
#echo "$volume_name: $required_space"
|
||||
total_space=$(echo "$total_space + $required_space" | bc)
|
||||
|
||||
[ -d "$directory" ] && existing_size=$(du -sb "$directory" | awk '{ total += $1 } END { print total }') || existing_size=0
|
||||
|
||||
cleanup_space=$(echo "$cleanup_space + existing_size" | bc)
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user