Hello Ermal,
On Mon, Feb 1, 2010 at 09:35, Ermal Luçi <[email protected]> wrote:
> On Fri, Jan 29, 2010 at 5:03 PM, Aarno Aukia <[email protected]> wrote:
>> On Fri, Jan 29, 2010 at 00:06, Scott Ullrich <[email protected]> wrote:
>> > On Thu, Jan 28, 2010 at 10:57 AM, Aarno Aukia <[email protected]>
>> > wrote:
>> >> bgpd is started twice when booting on 1.2.3-release with the newest
>> >> package. I suspect once from /usr/local/pkg/openbgpd.inc and once from
>> >> /usr/local/etc/rc.d/bgpd.sh ? When commenting out the exec("bgpd") in
>> >> /usr/local/pkg/openbgpd.inc it is only started once. Should the check
>> >> is_openbgpd_running() also be added to /usr/local/etc/rc.d/bgpd.sh or
>> >> is there a more favorable way ?
>> >
>> > Sounds reasonable.
>>
>> That would be:
>> $ diff -urNp openbgpd.inc.old openbgpd.inc
>> --- openbgpd.inc.old 2010-01-29 16:53:08.000000000 +0100
>> +++ openbgpd.inc 2010-01-29 17:00:55.000000000 +0100
>> @@ -153,7 +153,11 @@ function openbgpd_install_conf() {
>> $fd = fopen("/usr/local/etc/rc.d/bgpd.sh","w");
>> fwrite($fd, "#!/bin/sh\n\n");
>> fwrite($fd, "# This file was created by the pfSense package
>> manager.
>> Do not edit!\n\n");
>> - fwrite($fd, "/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf\n");
>> + fwrite($fd, "NUMBGPD=`ps auxw | grep bgpd | grep parent | grep -v
>> grep | wc -l | awk '{print \$1}'`\n");
>> + fwrite($fd, "#echo \$NUMBGPD\n");
>> + fwrite($fd, "if [ \$NUMBGPD -lt 0 ] ; then\n");
>> + fwrite($fd, " /usr/local/sbin/bgpd -f
>> /usr/local/etc/bgpd.conf\n");
>> + fwrite($fd, "fi\n");
>> fclose($fd);
>> exec("chmod a+rx /usr/local/etc/rc.d/bgpd.sh");
>> exec("chmod a-rw /usr/local/etc/bgpd.conf");
>
> This is missing a bgpctl reload in an else?!
Do you think executing /usr/local/etc/rc.d/bgpd.sh should issue a
"bgpctl reload" if bgpd is already running ? Although issuing an error
message (and maybe suggesting using bgpctl reload instead) if bgpd was
found already running would be the nice thing to do, I agree:
$ diff -urNp openbgpd.inc.old openbgpd.inc
--- openbgpd.inc.old 2010-01-29 16:53:08.000000000 +0100
+++ openbgpd.inc 2010-02-01 11:29:46.000000000 +0100
@@ -153,7 +153,13 @@ function openbgpd_install_conf() {
$fd = fopen("/usr/local/etc/rc.d/bgpd.sh","w");
fwrite($fd, "#!/bin/sh\n\n");
fwrite($fd, "# This file was created by the pfSense package manager.
Do not edit!\n\n");
- fwrite($fd, "/usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf\n");
+ fwrite($fd, "NUMBGPD=`ps auxw | grep bgpd | grep parent | grep -v
grep | wc -l | awk '{print \$1}'`\n");
+ fwrite($fd, "#echo \$NUMBGPD\n");
+ fwrite($fd, "if [ \$NUMBGPD -lt 0 ] ; then\n");
+ fwrite($fd, " /usr/local/sbin/bgpd -f /usr/local/etc/bgpd.conf\n");
+ fwrite($fd, "else\n");
+ fwrite($fd, " echo 'bgpd was not started because there is already a
process \"bgpd parent\" running. To reload the configuration please
issue \"bgpctl reload\".\n");
+ fwrite($fd, "fi\n");
fclose($fd);
exec("chmod a+rx /usr/local/etc/rc.d/bgpd.sh");
exec("chmod a-rw /usr/local/etc/bgpd.conf");
Regards,
Aarno
--
Aarno Aukia
Atrila GmbH
Switzerland
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Commercial support available - https://portal.pfsense.org