]> git.proxmox.com Git - pmg-api.git/commitdiff
PMG/Fetchmail.pm - autostart fetchmail service
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 18 Dec 2017 10:32:21 +0000 (11:32 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 18 Dec 2017 10:33:07 +0000 (11:33 +0100)
PMG/Fetchmail.pm
PMG/Utils.pm

index 5e44aa012bb12ec4039af104e959bfabaab31aaa..7e16c7967767a3a7b45198e0f5226bded569d82e 100644 (file)
@@ -7,6 +7,7 @@ use Data::Dumper;
 use PVE::Tools;
 use PVE::INotify;
 
+use PMG::Utils;
 use PMG::Config;
 use PMG::ClusterConfig;
 
@@ -239,6 +240,7 @@ sub update_fetchmail_default {
     if (($role eq '-') || ($role eq 'master')) {
        if (!!$enable != !!$is_enabled) {
            PVE::INotify::write_file('fetchmail_default', $enable);
+           PMG::Utils::service_cmd('fetchmail', 'restart');
        }
        if (! -e $config_link_filename) {
            symlink ($config_filename, $config_link_filename);
index 563d800e0a841e34bac916e2ddab40d856becaad..aa0da54965d7a32675621fe5f39e49271bf9f362 100644 (file)
@@ -574,6 +574,10 @@ sub service_cmd {
 
     if ($service eq 'pmgdaemon' || $service eq 'pmgproxy') {
        die "invalid service cmd '$service $cmd': ERROR" if $cmd eq 'stop';
+    } elsif ($service eq 'fetchmail') {
+       # use restart instead of start - else it does not start 'exited' unit
+       # after setting START_DAEMON=yes in /etc/default/fetchmail
+       $cmd = 'restart' if $cmd eq 'start';
     }
 
     $service = $service_aliases->{$service} // $service;