From a5b3aab72e466e7ec56bd100445777c5b8c54c87 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 18 Feb 2024 09:51:55 -0500 Subject: [PATCH] Update fstrim.sh tweak --- misc/fstrim.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/fstrim.sh b/misc/fstrim.sh index 06430eee..b3fc2c52 100644 --- a/misc/fstrim.sh +++ b/misc/fstrim.sh @@ -47,14 +47,16 @@ function trim_container() { local name=$(pct exec "$container" hostname 2>/dev/null || echo "No hostname because the container is not running") header_info echo -e "${BL}[Info]${GN} Trimming ${name} ${CL} \n" - local before_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"$container"'/) {gsub(/%/, "", $7); print $7}') + local before_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"vm-$container"'/) {gsub(/%/, "", $7); print $7}') echo -e "${RD}Data before trim $before_trim%${CL}" pct fstrim $container - local after_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"$container"'/) {gsub(/%/, "", $7); print $7}') + local after_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"vm-$container"'/) {gsub(/%/, "", $7); print $7}') echo -e "${GN}Data after trim $after_trim%${CL}" sleep 1.5 } + + for container in $(pct list | awk '{if(NR>1) print $1}'); do if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then header_info