summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}
}