[pve-devel] [PATCH manager 2/2] vzdump: send mail if job-abort hook fails

Fiona Ebner f.ebner at proxmox.com
Wed Nov 16 09:30:14 CET 2022


Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 PVE/VZDump.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 9ef3c7b4..a04837e7 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1287,9 +1287,9 @@ sub exec_backup {
     };
     my $err = $@;
 
-    $self->run_hook_script ('job-abort', undef, $job_end_fd) if $err;
-
     if ($err) {
+	eval { $self->run_hook_script ('job-abort', undef, $job_end_fd); };
+	$err .= $@ if $@;
 	debugmsg ('err', "Backup job failed - $err", undef, 1);
     } else {
 	if ($errcount) {
-- 
2.30.2






More information about the pve-devel mailing list