mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-28 11:50:06 +00:00
fix(update-lxcs/apps): avoid pct exec on containers mid-shutdown (#14050)
Both update-lxcs.sh and update-apps.sh backgrounded pct shutdown and then immediately called pct exec on the same container, causing 'Error: unexpected status' which terminated the loop after the first container. update-lxcs.sh: wrapped reboot-required and patchmon-agent checks in a guard that only runs them when the container was already running (not one that was started and is now being shut down). update-apps.sh: moved pct set (resource reset) and the pct exec reboot-required check to run before pct shutdown is issued. Fixes #14027
This commit is contained in:
parent
c32ca537f1
commit
585de1ba0c
2 changed files with 16 additions and 14 deletions
|
|
@ -405,11 +405,6 @@ for container in $CHOICE; do
|
||||||
esac
|
esac
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
|
||||||
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
|
||||||
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
|
|
||||||
pct shutdown $container &
|
|
||||||
fi
|
|
||||||
|
|
||||||
#5) if build resources are different than run resources, then:
|
#5) if build resources are different than run resources, then:
|
||||||
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
if [ "$UPDATE_BUILD_RESOURCES" -eq "1" ]; then
|
||||||
pct set "$container" --cores "$run_cpu" --memory "$run_ram"
|
pct set "$container" --cores "$run_cpu" --memory "$run_ram"
|
||||||
|
|
@ -421,6 +416,11 @@ for container in $CHOICE; do
|
||||||
containers_needing_reboot+=("$container ($container_hostname)")
|
containers_needing_reboot+=("$container ($container_hostname)")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
|
||||||
|
pct shutdown $container &>/dev/null &
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $exit_code -eq 0 ]; then
|
if [ $exit_code -eq 0 ]; then
|
||||||
msg_ok "Updated container $container"
|
msg_ok "Updated container $container"
|
||||||
elif [ $exit_code -eq 75 ]; then
|
elif [ $exit_code -eq 75 ]; then
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
||||||
elif [ "$status" == "status: running" ]; then
|
elif [ "$status" == "status: running" ]; then
|
||||||
update_container $container
|
update_container $container
|
||||||
fi
|
fi
|
||||||
|
if [ "$status" == "status: running" ]; then
|
||||||
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
|
if pct exec "$container" -- [ -e "/var/run/reboot-required" ]; then
|
||||||
# Get the container's hostname and add it to the list
|
# Get the container's hostname and add it to the list
|
||||||
container_hostname=$(pct exec "$container" hostname)
|
container_hostname=$(pct exec "$container" hostname)
|
||||||
|
|
@ -121,6 +122,7 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
||||||
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
pct exec "$container" -- "/usr/local/bin/patchmon-agent" "report"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
wait
|
wait
|
||||||
header_info
|
header_info
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue