From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6B0E71F5AE; Tue, 20 Jul 2021 20:34:33 +0000 (UTC) Date: Tue, 20 Jul 2021 20:34:33 +0000 From: Eric Wong To: Konstantin Ryabitsev Cc: meta@public-inbox.org Subject: Re: Restarting daemons on config file change Message-ID: <20210720203433.GA28287@dcvr> References: <20210719200318.wo4ydjonc3u3ibtu@nitro.local> <20210719204935.GA31835@dcvr> <20210720170019.p5d23tjb4v2mrekn@nitro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210720170019.p5d23tjb4v2mrekn@nitro.local> List-Id: Konstantin Ryabitsev wrote: > On Mon, Jul 19, 2021 at 08:49:35PM +0000, Eric Wong wrote: > > > The best I can think of is a systemd watcher service that automatically > > > restarts the daemons when the config file is modified, but I wanted to check > > > here first to see if perhaps I'm missing something simpler. > > > > Yes, a systemd.path unit might be the way to go. A patch for > > examples/ would be appreciated if you go down that route :> > > Okay, let me see what I can come up with. Looks like the best course of action > is to: > > 1. use a global blocking lock > 2. copy the config file to a new location > 3. make the necessary changes to the temporary config file > 4. move the temp config file to overwrite the current config > 5. release the lock public-inbox-init already does all of that. It doesn't set all possible keys, yet (e.g. infourl, maybe some others). > This would make sure that there is are no races and that all changes show up > at once and don't repeatedly trigger the path watcher.