Update update-lxcs.sh
use the command line to exclude multiple containers simultaneously
This commit is contained in:
parent
c47326ff25
commit
dc4e460b3c
1 changed files with 18 additions and 6 deletions
|
@ -34,8 +34,7 @@ while true; do
|
|||
esac
|
||||
done
|
||||
clear
|
||||
exclude_container="$@"
|
||||
containers=$(pct list | tail -n +2 | cut -f1 -d' ' | grep -vE "^($exclude_container)$")
|
||||
excluded_containers=("$@")
|
||||
function update_container() {
|
||||
container=$1
|
||||
header_info
|
||||
|
@ -50,7 +49,19 @@ function update_container() {
|
|||
esac
|
||||
}
|
||||
header_info
|
||||
for container in $containers; do
|
||||
for container in $(pct list | tail -n +2 | cut -f1 -d' '); do
|
||||
excluded=false
|
||||
for excluded_container in "${excluded_containers[@]}"; do
|
||||
if [ "$container" == "$excluded_container" ]; then
|
||||
excluded=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$excluded" == true ]; then
|
||||
header_info
|
||||
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
|
||||
sleep 1
|
||||
else
|
||||
status=$(pct status $container)
|
||||
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
|
||||
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||
|
@ -64,6 +75,7 @@ for container in $containers; do
|
|||
elif [ "$status" == "status: running" ]; then
|
||||
update_container $container
|
||||
fi
|
||||
fi
|
||||
done
|
||||
wait
|
||||
header_info
|
||||
|
|
Loading…
Reference in a new issue