Update fstrim.sh

display CTID instead of hostname
This commit is contained in:
tteckster 2024-02-19 04:43:10 -05:00 committed by GitHub
parent b7bfe7df14
commit b082f8a08e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,9 +44,8 @@ excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "
function trim_container() { function trim_container() {
local container=$1 local container=$1
local name=$(pct exec "$container" hostname 2>/dev/null || echo "No hostname because the container is not running")
header_info header_info
echo -e "${BL}[Info]${GN} Trimming ${name} ${CL} \n" echo -e "${BL}[Info]${GN} Trimming ${container} ${CL} \n"
local before_trim=$(lvs | awk -F '[[:space:]]+' 'NR>1 && (/Data%|'"vm-$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}" echo -e "${RD}Data before trim $before_trim%${CL}"
pct fstrim $container pct fstrim $container
@ -66,7 +65,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false") template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
if [ "$template" == "true" ]; then if [ "$template" == "true" ]; then
header_info header_info
echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container is a template ${CL} \n" echo -e "${BL}[Info]${GN} Skipping ${container} ${RD}$container is a template ${CL} \n"
sleep 1 sleep 1
continue continue
fi fi