mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-18 16:32:17 +00:00
fix(pve-privilege-converter): handle already stopped container in manage_states (#12765)
This commit is contained in:
@@ -134,16 +134,20 @@ manage_states() {
|
|||||||
read -rp "Shutdown source and start new container? [Y/n]: " answer
|
read -rp "Shutdown source and start new container? [Y/n]: " answer
|
||||||
answer=${answer:-Y}
|
answer=${answer:-Y}
|
||||||
if [[ $answer =~ ^[Yy] ]]; then
|
if [[ $answer =~ ^[Yy] ]]; then
|
||||||
pct shutdown "$CONTAINER_ID"
|
|
||||||
for i in {1..36}; do
|
|
||||||
sleep 5
|
|
||||||
! pct status "$CONTAINER_ID" | grep -q running && break
|
|
||||||
done
|
|
||||||
if pct status "$CONTAINER_ID" | grep -q running; then
|
if pct status "$CONTAINER_ID" | grep -q running; then
|
||||||
read -rp "Timeout reached. Force shutdown? [Y/n]: " force
|
pct shutdown "$CONTAINER_ID"
|
||||||
if [[ ${force:-Y} =~ ^[Yy] ]]; then
|
for i in {1..36}; do
|
||||||
pkill -9 -f "lxc-start -F -n $CONTAINER_ID"
|
sleep 5
|
||||||
|
! pct status "$CONTAINER_ID" | grep -q running && break
|
||||||
|
done
|
||||||
|
if pct status "$CONTAINER_ID" | grep -q running; then
|
||||||
|
read -rp "Timeout reached. Force shutdown? [Y/n]: " force
|
||||||
|
if [[ ${force:-Y} =~ ^[Yy] ]]; then
|
||||||
|
pkill -9 -f "lxc-start -F -n $CONTAINER_ID"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
msg_custom "ℹ️" "\e[36m" "Source container $CONTAINER_ID is already stopped"
|
||||||
fi
|
fi
|
||||||
pct start "$NEW_CONTAINER_ID"
|
pct start "$NEW_CONTAINER_ID"
|
||||||
msg_ok "New container started"
|
msg_ok "New container started"
|
||||||
|
|||||||
Reference in New Issue
Block a user