mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-16 20:29:45 +00:00
Enable and update VM cleanup logic in openwrt-vm.sh
Uncommented and updated the cleanup_vmid function to stop and destroy the VM if it exists. Also enabled its invocation in the error handler to ensure proper resource cleanup on errors.
This commit is contained in:
parent
902dcfaed0
commit
2cee17af00
1 changed files with 7 additions and 7 deletions
|
@ -77,7 +77,7 @@ function error_handler() {
|
|||
post_update_to_api "failed" "$command"
|
||||
local error_message="${RD}[ERROR]${CL} in line ${RD}$line_number${CL}: exit code ${RD}$exit_code${CL}: while executing command ${YW}$command${CL}"
|
||||
echo -e "\n$error_message\n"
|
||||
#cleanup_vmid
|
||||
cleanup_vmid
|
||||
}
|
||||
|
||||
function get_valid_nextid() {
|
||||
|
@ -97,12 +97,12 @@ function get_valid_nextid() {
|
|||
echo "$try_id"
|
||||
}
|
||||
|
||||
# function cleanup_vmid() {
|
||||
# if qm status $VMID &>/dev/null; then
|
||||
# qm stop $VMID &>/dev/null
|
||||
# #qm destroy $VMID &>/dev/null
|
||||
# fi
|
||||
# }
|
||||
function cleanup_vmid() {
|
||||
if qm status $VMID &>/dev/null; then
|
||||
qm stop $VMID &>/dev/null
|
||||
qm destroy $VMID &>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
popd >/dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue