follow symlinks when calculating size

This commit is contained in:
goldsquid
2025-12-19 12:15:47 +07:00
parent 578d558d3f
commit 74716312d0
2 changed files with 3 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ for key in $keys; do
prefix="/var/lib/docker/volumes/rpc_$key" prefix="/var/lib/docker/volumes/rpc_$key"
volume_size=$(du -s $prefix 2>/dev/null | awk '{print $1}') volume_size=$(du -sL $prefix 2>/dev/null | awk '{print $1}')
total_size=$((total_size + volume_size)) total_size=$((total_size + volume_size))
done done

View File

@@ -12,7 +12,7 @@ for key in $keys; do
prefix="/var/lib/docker/volumes/rpc_$key" prefix="/var/lib/docker/volumes/rpc_$key"
volume_size=$(du -s $prefix 2>/dev/null | awk '{print $1}') volume_size=$(du -sL $prefix 2>/dev/null | awk '{print $1}')
total_size=$((total_size + volume_size)) total_size=$((total_size + volume_size))
@@ -20,7 +20,7 @@ for key in $keys; do
# Check if the path exists # Check if the path exists
if [[ -e "$prefix/_data/$path" ]]; then if [[ -e "$prefix/_data/$path" ]]; then
# Print the size of the file or directory # Print the size of the file or directory
size=$(du -s "$prefix/_data/$path" 2>/dev/null | awk '{print $1}') size=$(du -sL "$prefix/_data/$path" 2>/dev/null | awk '{print $1}')
static_size=$((static_size + size)) static_size=$((static_size + size))
#echo "$path: $size" #echo "$path: $size"
fi fi