From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 6F9FD138334 for ; Tue, 5 Mar 2019 15:01:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 76F97E08BB; Tue, 5 Mar 2019 15:01:17 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0AD6AE08A2 for ; Tue, 5 Mar 2019 15:01:16 +0000 (UTC) Received: from [192.168.1.100] (c-98-218-46-55.hsd1.md.comcast.net [98.218.46.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mjo) by smtp.gentoo.org (Postfix) with ESMTPSA id 9FC56335D0E for ; Tue, 5 Mar 2019 15:01:15 +0000 (UTC) Subject: Re: [gentoo-user] Question about bird init script To: gentoo-user@lists.gentoo.org References: <20190304103357.x6gvk2ln6xvzbu3l@mew.swordarmor.fr> <20190305110356.6jwatzzujetswpde@mew.swordarmor.fr> From: Michael Orlitzky Message-ID: Date: Tue, 5 Mar 2019 10:01:08 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 In-Reply-To: <20190305110356.6jwatzzujetswpde@mew.swordarmor.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Archives-Salt: c645fa25-3998-4717-b58d-5ea6b061bf37 X-Archives-Hash: 7b3cb22ddb260e87ba077f7ee6c335e7 On 3/5/19 6:03 AM, Alarig Le Lay wrote: > Okay, I tried to write another script: > https://git.grifon.fr/alarig/SwordArMor-gentoo-overlay/src/branch/master/net-misc/bird/files/initd-bird-2 > > I deleted things, but added others. I’m not sure if I respect all the > openrc standards as I’m not very comfortable with it. That's OK, it already looks a lot better. And it works, which is nice =) > > I added a check_run() function because I want to use the bird config > parser if it’s running. You probably want to specify the config file in check_run(). You might refactor the command_args as follows, client_args="-c ${CONF_FILE} -s ${SOCK}" command_args="${client_args} -P ${pidfile}" and then in check_run, you can use "birdc ${client_args}..." > > I added my own stop() function because bird has to wait for all the > sessions to be closed before killing the process. There's a "retry" variable that you can set at the top-level: retry Retry schedule to use when stopping the daemon. It can either be a timeout in seconds or multiple signal/time‐ out pairs (like SIGTERM/5). (from "man openrc-run") The default stop() function will use that, so you shouldn't need to write your own stop() if you set "retry=15". > > I’m open to your comments and improvements :) > The checkconfig() function isn't used any more, so it can be deleted. So long as bird crashes with an error like "no config file!" when the file is missing, I don't think you need to check for it yourself. These days /var/run is simply a symlink to /run, so those two paths can be shortened. Once you've used it for a while and are confident that everything works, please file a bug to include the improved script in the tree!