public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api v3 3/3] api: fetchmail: restart fetchmail on config changes
Date: Fri, 26 Sep 2025 21:27:12 +0200	[thread overview]
Message-ID: <20250926192941.89086-6-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20250926192941.89086-1-s.ivanov@proxmox.com>

Based on feedback from Max (big Thanks!) in:
https://lore.proxmox.com/pmg-devel/DD2PXG51NFKF.2D5G45FY3K66F@proxmox.com/T/#t

The handling of fetchmail config can probably still be improved, but
restarting the daemon, when something changes (it was the easiest way
I found to get fetchmail to re-read its config) should improve UX
quite a bit. IIRC currently changing the config still requires
restarting fetchmail on the commandline (or rebooting).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/API2/Fetchmail.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PMG/API2/Fetchmail.pm b/src/PMG/API2/Fetchmail.pm
index d90c016e..d94b5f52 100644
--- a/src/PMG/API2/Fetchmail.pm
+++ b/src/PMG/API2/Fetchmail.pm
@@ -203,6 +203,7 @@ __PACKAGE__->register_method({
             $fmcfg->{$id} = $entry;
 
             PVE::INotify::write_file('fetchmailrc', $fmcfg);
+            PMG::Utils::service_cmd('fetchmail', 'restart')
         };
 
         PMG::Config::lock_config($code, "update fechtmail configuration failed");
@@ -242,6 +243,7 @@ __PACKAGE__->register_method({
             }
 
             PVE::INotify::write_file('fetchmailrc', $fmcfg);
+            PMG::Utils::service_cmd('fetchmail', 'restart')
         };
 
         PMG::Config::lock_config($code, "update fechtmail configuration failed");
@@ -280,6 +282,7 @@ __PACKAGE__->register_method({
             delete $fmcfg->{$id};
 
             PVE::INotify::write_file('fetchmailrc', $fmcfg);
+            PMG::Utils::service_cmd('fetchmail', 'restart')
         };
 
         PMG::Config::lock_config($code, "delete fechtmail configuration failed");
-- 
2.47.3



_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel


      parent reply	other threads:[~2025-09-26 19:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26 19:27 [pmg-devel] [PATCH pmg-api/package-rebuilds v3] improve fetchmail handling in PMG Stoiko Ivanov
2025-09-26 19:27 ` [pmg-devel] [PATCH package-rebuilds v3 1/2] fetchmail: d/rules: do not skip dh_installinit Stoiko Ivanov
2025-09-26 19:27 ` [pmg-devel] [PATCH package-rebuilds v3 2/2] fetchmail: improve shipped service file Stoiko Ivanov
2025-09-26 19:27 ` [pmg-devel] [PATCH pmg-api v3 1/3] fix #6798: fetchmail: adapt to changed sslproto semantics Stoiko Ivanov
2025-09-26 19:27 ` [pmg-devel] [PATCH pmg-api v3 2/3] templates: fetchmail: add comment where users can add manual accounts Stoiko Ivanov
2025-09-26 19:27 ` Stoiko Ivanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250926192941.89086-6-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal