Update clean-lxcs.sh

tweak
This commit is contained in:
tteckster 2023-09-06 02:59:48 -04:00 committed by GitHub
parent 9cfa051700
commit b8ebc36c51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ GN=$(echo "\033[1;92m")
CL=$(echo "\033[m") CL=$(echo "\033[m")
header_info header_info
while true; do while true; do
read -p "This Will Clean logs, cache and update apt lists on all LXC Containers. Proceed(y/n)?" yn read -p "This Will Clean logs, cache and update apt lists on selected LXC Containers. Proceed(y/n)?" yn
case $yn in case $yn in
[Yy]*) break ;; [Yy]*) break ;;
[Nn]*) exit ;; [Nn]*) exit ;;
@ -33,7 +33,7 @@ while true; do
esac esac
done done
clear clear
TITLE="Containers on node" NODE=$(hostname)
while read -r line; do while read -r line; do
TAG=$(echo "$line" | awk '{print $1}') TAG=$(echo "$line" | awk '{print $1}')
ITEM=$(echo "$line" | awk '{print substr($0,36)}') ITEM=$(echo "$line" | awk '{print substr($0,36)}')
@ -43,7 +43,7 @@ while read -r line; do
fi fi
CTID_MENU+=("$TAG" "$ITEM " "OFF") CTID_MENU+=("$TAG" "$ITEM " "OFF")
done < <(pct list | awk 'NR>1') done < <(pct list | awk 'NR>1')
excluded_containers=$(whiptail --title "$TITLE" --checklist \ excluded_containers=$(whiptail --title "Containers on $NODE" --checklist \
"\nSelect containers to skip from cleaning:\n" \ "\nSelect containers to skip from cleaning:\n" \
16 $(($MSG_MAX_LENGTH + 23)) 6 \ 16 $(($MSG_MAX_LENGTH + 23)) 6 \
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit "${CTID_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit