aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/openbgpd/openbgpd.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc
index 4ad621e7..19ef8b43 100644
--- a/config/openbgpd/openbgpd.inc
+++ b/config/openbgpd/openbgpd.inc
@@ -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");