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 2D768138334 for ; Tue, 5 Mar 2019 11:04:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4E05CE092E; Tue, 5 Mar 2019 11:04:05 +0000 (UTC) Received: from edrik.securmail.fr (edrik.securmail.fr [89.234.186.243]) (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 B0E02E0921 for ; Tue, 5 Mar 2019 11:04:03 +0000 (UTC) Received: by edrik.securmail.fr (Postfix, from userid 58) id 070E1B0D48; Tue, 5 Mar 2019 12:03:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=swordarmor.fr; s=swordarmor; t=1551783839; bh=FgZgozKhWio96zJCcoH32Fg1G/pt8GK5mzR4QVx4COg=; h=Date:From:To:Subject:References:In-Reply-To; b=Qk/hZgZ57dI1ulH15iNQrHasMk1n+lwltMATJoC0yVeC5g4Aqt+mwyYzSUwYRDrgx YH3uqNajnSydFWyk18CLzbzxNfS7mwjBWmO3vudpCES5pq2iOb+HiiP7UwvGrpWaAP nzd35hBeqqwRdO2v8U8ef47yCLJc4V+kXQXYWlV0= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on edrik.securmail.fr X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_INVALID, DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.2 Received: from mew.swordarmor.fr (mew.swordarmor.fr [IPv6:2a00:5884:102:1::4]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: alarig@swordarmor.fr) by edrik.securmail.fr (Postfix) with ESMTPSA id 1B9B2B0D26 for ; Tue, 5 Mar 2019 12:03:58 +0100 (CET) Authentication-Results: edrik.securmail.fr/1B9B2B0D26; dmarc=none (p=none dis=none) header.from=swordarmor.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=swordarmor.fr; s=swordarmor; t=1551783838; bh=FgZgozKhWio96zJCcoH32Fg1G/pt8GK5mzR4QVx4COg=; h=Date:From:To:Subject:References:In-Reply-To; b=qEtMvRLu/wkcNOAS5K9b2TY1zZhsIyZ8JR0QFjsNtI5+km8oTUuA4XHFmmaV8zWjc XcyHDuRVIl60uBctTRy6/bZm8lm6hHMIvD8lYpp8aAlOyGuA8gEZdCBztr8ptqH62l a69FI1JbCJdj70B8ToqIQFoisO+JsEt9BZkFaO18= Date: Tue, 5 Mar 2019 12:03:57 +0100 From: Alarig Le Lay To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Question about bird init script Message-ID: <20190305110356.6jwatzzujetswpde@mew.swordarmor.fr> References: <20190304103357.x6gvk2ln6xvzbu3l@mew.swordarmor.fr> 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 X-Archives-Salt: 3454be7a-f2b3-45db-9867-14fddeb7ae16 X-Archives-Hash: 62326d1d77d6fdc826747ae47485ed55 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. I added a check_run() function because I want to use the bird config parser if it’s running. I added my own stop() function because bird has to wait for all the sessions to be closed before killing the process. I don’t know if I should make the configuration file and the sock file configurable with /etc/conf.d/bird I’m open to your comments and improvements :) My script behave like this: judicael-ovpn2 ~ # ps aux | grep bird root 3928 0.0 0.3 25752 7944 pts/1 S+ Mar04 0:04 vim /etc/init.d/bird root 5250 0.0 0.1 10860 2052 pts/3 S+ 11:31 0:00 grep --colour=auto bird judicael-ovpn2 ~ # rc-service bird start * Starting bird ... [ ok ] judicael-ovpn2 ~ # ps aux | grep bird root 3928 0.0 0.3 25752 7944 pts/1 S+ Mar04 0:04 vim /etc/init.d/bird root 5383 62.8 1.8 42184 37080 ? Rs 11:31 0:03 /usr/sbin/bird -c /etc/bird.conf -s /var/run/bird.ctl -P /var/run/bird.pid root 5400 0.0 0.1 10860 2236 pts/3 S+ 11:31 0:00 grep --colour=auto bird judicael-ovpn2 ~ # birdc 'sh pr' BIRD 2.0.4 ready. Name Proto Table State Since Info device1 Device --- up 11:31:26.782 direct1 Direct --- up 11:31:26.782 kernel_ipv4 Kernel master4 up 11:31:26.782 kernel_ipv6 Kernel master6 up 11:31:26.782 ibgp_nominoe_ipv4 BGP --- up 11:31:28.777 Established ibgp_nominoe_ipv6 BGP --- up 11:31:28.205 Established ibgp_budic_ipv4 BGP --- up 11:31:30.703 Established ibgp_budic_ipv6 BGP --- up 11:31:28.614 Established ospf_ipv4 OSPF master4 up 11:31:26.782 Running ospf_ipv6 OSPF master6 up 11:31:26.782 Running judicael-ovpn2 ~ # rc-service bird reload * Reloading BIRD ... [ ok ] judicael-ovpn2 ~ # rc-service bird restart * Stopping BIRD ... * Starting bird ... [ ok ] judicael-ovpn2 ~ # rc-service bird status * status: started So basically it works, and the error check as well: judicael-ovpn2 ~ # echo 'ezf' >> /etc/bird.conf judicael-ovpn2 ~ # rc-service bird reload * /etc/bird.conf:121:1 syntax error, unexpected SYM judicael-ovpn2 ~ # rc-service bird restart * Caching service dependencies ... [ ok ] * /etc/bird.conf:121:1 syntax error, unexpected SYM * ERROR: bird failed to stop judicael-ovpn2 ~ # sed -i '$d' /etc/bird.conf judicael-ovpn2 ~ # rc-service bird reload * Reloading BIRD ... [ ok ] -- Alarig