Ver código fonte

Update update-lxcs.sh

add information about the boot disk, which provides an easy way to determine if you need to expand the disk.
tteckster 2 anos atrás
pai
commit
92babeac23
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      misc/update-lxcs.sh

+ 3 - 1
misc/update-lxcs.sh

@@ -39,7 +39,9 @@ function update_container() {
   container=$1
   container=$1
   header_info
   header_info
   name=$(pct exec "$container" hostname)
   name=$(pct exec "$container" hostname)
-  echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} \n"
+  disk_info=$(pct exec "$container" df /boot | awk 'NR==2{gsub("%","",$5); printf "%s %.1fG %.1fG %.1fG", $5, $3/1024/1024, $2/1024/1024, $4/1024/1024 }')
+  read -ra disk_info_array <<< "$disk_info"
+  echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}Boot Disk: ${disk_info_array[0]}% full [${disk_info_array[1]}/${disk_info_array[2]} used, ${disk_info_array[3]} free]${CL}\n"
   os=$(pct config "$container" | awk '/^ostype/ {print $2}')
   os=$(pct config "$container" | awk '/^ostype/ {print $2}')
   case "$os" in
   case "$os" in
     alpine)  pct exec "$container" -- ash -c "apk update && apk upgrade" ;;
     alpine)  pct exec "$container" -- ash -c "apk update && apk upgrade" ;;