[pve-devel] [PATCH guest-common] Send email when a replication job fails.

Philip Abernethy p.abernethy at proxmox.com
Tue Oct 3 10:20:27 CEST 2017


On Tue, Oct 03, 2017 at 09:55:06AM +0200, Wolfgang Link wrote:
> A email notification will be send for each job when the job fails.
> This message will continued as long the job is failing.
> ---
>  PVE/Replication.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/Replication.pm b/PVE/Replication.pm
> index e53928e..0075b45 100644
> --- a/PVE/Replication.pm
> +++ b/PVE/Replication.pm
> @@ -358,7 +358,10 @@ my $run_replication_nolock = sub {
>  
>  	close($logfd);
>  
> -	die $err if $err && !$noerr;
> +	if ($err) {
> +	    PVE::Tools::sendmail('root at localhost', "Replication Job: $jobcfg->{id} failed", $err);
Please use 'root' instead of 'root at localhost'. This allows postfix to
fill in the proper FQDN itself, resulting in a more useful sender
address.
> +	    die $err if !$noerr;
> +	}
>      };
>      if (my $err = $@) {
>  	if ($noerr) {
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list