[pmg-devel] [PATCH pmg-api 4/4] pmg-daily: run sa-update for local channels

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Dec 30 14:07:29 CET 2020


On December 16, 2020 6:18 pm, Stoiko Ivanov wrote:
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>  src/bin/pmg-daily | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bin/pmg-daily b/src/bin/pmg-daily
> index 32ccb95..f5b0650 100755
> --- a/src/bin/pmg-daily
> +++ b/src/bin/pmg-daily
> @@ -73,12 +73,21 @@ if (my $http_proxy = $cfg->get('admin', 'http_proxy')) {
>  }
>  
>  # update spamassassin rules
> +my $restart_filter = 0;
>  if (system('sa-update') == 0) {
>      # if the exit code is 0, new updates were downloaded
>      # then restart the pmg-smtp-filter to load the new rules
> -    PMG::Utils::service_cmd('pmg-smtp-filter', 'restart');
> +    $restart_filter = 1;
>  }
>  
> +eval {
> +    $restart_filter ||= PMG::Utils::update_local_spamassassin_channels(0);
> +};
> +if (my $err = $@) {
> +    syslog('err', $err);
> +}

could just be

syslog(..) if $@

> +
> +PMG::Utils::service_cmd('pmg-smtp-filter', 'restart') if $restart_filter;
>  # run bayes database maintainance
>  system('sa-learn --force-expire >/dev/null 2>&1');
>  
> -- 
> 2.20.1
> 
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
> 
> 
> 




More information about the pmg-devel mailing list