mirror of https://github.com/tteck/Proxmox.git
				
				
				
			
							parent
							
								
									8d55efd704
								
							
						
					
					
						commit
						a5b3aab72e
					
				| 
						 | 
					@ -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")
 | 
					  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 ${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}"
 | 
					  echo -e "${RD}Data before trim $before_trim%${CL}"
 | 
				
			||||||
  pct fstrim $container
 | 
					  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}"
 | 
					  echo -e "${GN}Data after trim $after_trim%${CL}"
 | 
				
			||||||
  sleep 1.5
 | 
					  sleep 1.5
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for container in $(pct list | awk '{if(NR>1) print $1}'); do
 | 
					for container in $(pct list | awk '{if(NR>1) print $1}'); do
 | 
				
			||||||
  if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then
 | 
					  if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then
 | 
				
			||||||
    header_info
 | 
					    header_info
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue