summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-01-28 16:35:26 -0800
committerslioch <slioch@eng-140.vyatta.com>2009-01-28 16:35:26 -0800
commit4841f59c457d89b542916d2768e390cd21c5ec7e (patch)
treed979ce54d0e4af8eff1d3b51c8e2213c49b0d03a
parentb162cc2c05aca6f3eded6484d13bd98f224a6f26 (diff)
downloadvyatta-wanloadbalance-4841f59c457d89b542916d2768e390cd21c5ec7e.tar.gz
vyatta-wanloadbalance-4841f59c457d89b542916d2768e390cd21c5ec7e.zip
fix for problem found in webgui on restarting process.
-rwxr-xr-x[-rw-r--r--]scripts/vyatta-wanloadbalance.init11
-rw-r--r--src/main.cc6
2 files changed, 11 insertions, 6 deletions
diff --git a/scripts/vyatta-wanloadbalance.init b/scripts/vyatta-wanloadbalance.init
index decb811..906fd18 100644..100755
--- a/scripts/vyatta-wanloadbalance.init
+++ b/scripts/vyatta-wanloadbalance.init
@@ -10,21 +10,26 @@ test -x $bb || exit 0
start ()
{
- /opt/vyatta/sbin/wan_lb -f $conf -d -i $pid
+echo 'astart';
+# /opt/vyatta/sbin/wan_lb -f /var/load-balance/wlb.conf -d -i $pid 1>/dev/null
+ start-stop-daemon --background --start --quiet --oknodo --exec /opt/vyatta/sbin/wan_lb -- -f /var/load-balance/wlb.conf -d -i $pid
}
stop ()
{
+echo 'stop';
if [ -f $pid ]
then
- kill -s SIGTERM $( cat $pid ) 2>/dev/null
- fi
+ kill -s SIGTERM $( cat $pid )
+ fi
}
case "$action" in
start) start;;
stop) stop;;
+ force-reload) stop; sleep 1; start;;
restart) stop; sleep 1; start;;
*) echo "Usage: $progname {start|stop|restart}"
exit 1
esac
+echo 0
diff --git a/src/main.cc b/src/main.cc
index d42abb9..b852cfd 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -7,7 +7,7 @@
*/
#include <sys/types.h>
#include <sys/stat.h>
-//#include <sys/wait.h>
+#include <sys/wait.h>
#include <signal.h>
#include <syslog.h>
#include <stdio.h>
@@ -106,10 +106,10 @@ int main(int argc, char* argv[])
exit(0);
}
+ int s = 0;
if (daemon) {
if (fork() != 0) {
- // int s;
- // wait(&s);
+ wait(&s);
exit(0);
}
}