Fix restore: correct removeacct argument order, add debug output
cPanel's removeacct expects username before flags. Also capture and log the command output to aid debugging if termination still fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -131,11 +131,14 @@ restore_full_account() {
|
||||
# Terminate existing account if requested
|
||||
if [[ "$terminate" == "true" ]] && account_exists "$user"; then
|
||||
log_info "Terminating existing account $user before restore..."
|
||||
if ! /scripts/removeacct --force "$user"; then
|
||||
local removeacct_output
|
||||
if ! removeacct_output=$(/scripts/removeacct "$user" --force 2>&1); then
|
||||
log_error "Failed to terminate account $user"
|
||||
log_debug "removeacct output: $removeacct_output"
|
||||
rm -rf "$restore_dir"
|
||||
return 1
|
||||
fi
|
||||
log_debug "removeacct output: $removeacct_output"
|
||||
fi
|
||||
|
||||
# Run restorepkg (--force to merge into existing account if present)
|
||||
|
||||
Reference in New Issue
Block a user