diff options
author | thompsa <andy@fud.org.nz> | 2010-03-25 21:53:41 +1300 |
---|---|---|
committer | thompsa <andy@fud.org.nz> | 2010-03-25 21:55:21 +1300 |
commit | da79c6705e8f3cf5fb1c29dac6ea8167e5bc5410 (patch) | |
tree | e99635b40a14669d5dda76457ba2ea9382bd43b3 /config/openospfd/openospfd.inc | |
parent | 808bf684dbce12ddefcfb995d26f2a4fabb612d3 (diff) | |
download | pfsense-packages-da79c6705e8f3cf5fb1c29dac6ea8167e5bc5410.tar.gz pfsense-packages-da79c6705e8f3cf5fb1c29dac6ea8167e5bc5410.tar.bz2 pfsense-packages-da79c6705e8f3cf5fb1c29dac6ea8167e5bc5410.zip |
Be safer about reloading ospfd. Use the return value of ospfctl to
determine if ospfd is running which is more reliable than grokking ps.
Diffstat (limited to 'config/openospfd/openospfd.inc')
-rw-r--r-- | config/openospfd/openospfd.inc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/config/openospfd/openospfd.inc b/config/openospfd/openospfd.inc index d6a3e67d..c6368271 100644 --- a/config/openospfd/openospfd.inc +++ b/config/openospfd/openospfd.inc @@ -176,10 +176,10 @@ function ospfd_install_conf() { exec("chmod u+rw /usr/local/etc/ospfd.conf"); // ospfd process running? if so reload, elsewise start. - if(is_ospfd_running() == true) { - exec("/usr/local/sbin/ospfctl reload"); - } else { - exec("/usr/local/sbin/ospfd"); + exec("/usr/local/sbin/ospfctl reload", $rval); + if ($rval != 0) { + exec("/bin/pkill -x ospfd"); + exec("/usr/local/sbin/ospfd -f /usr/local/etc/ospfd.conf"); } conf_mount_ro(); @@ -231,13 +231,4 @@ function ospfd_put_raw_config($conffile) { $config['installedpackages']['ospfd']['rawconfig'] = $conffile; } } - -function is_ospfd_running() { - $status = `ps awux | grep ospfd | grep "parent" | grep -v grep | wc -l | awk '{ print \$1 }'`; - if(intval($status) > 0) - return true; - else - return false; -} - ?> |