Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
[bugfix] nftlb is killed when zevenet is stopped
Browse files Browse the repository at this point in the history
Signed-off-by: Alvaro Cano <alvaro.cano@zevenet.com>

	modified:   DEBIAN/control
	modified:   usr/local/zevenet/bin/nftlbd
	modified:   usr/local/zevenet/bin/zevenet
  • Loading branch information
cano-devel committed Sep 11, 2019
1 parent 9cdb85f commit ab93a9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DEBIAN/control
@@ -1,5 +1,5 @@
Package: zevenet Package: zevenet
Version: 5.9.2 Version: 5.9.3
Maintainer: Zevenet SL <zevenet-ce-users@zevenet.com> Maintainer: Zevenet SL <zevenet-ce-users@zevenet.com>
Architecture: amd64 Architecture: amd64
Section: admin Section: admin
Expand Down
21 changes: 15 additions & 6 deletions usr/local/zevenet/bin/nftlbd
@@ -1,19 +1,26 @@
#!/bin/sh #!/bin/sh


DEBUG="" DEBUG=""
NFTBIN=/usr/local/sbin/nft
#NFTBIN=`which nft`
GLOBALCONF="/usr/local/zevenet/config/global.conf" GLOBALCONF="/usr/local/zevenet/config/global.conf"
if [ -f "$GLOBALCONF" ]; then if [ -f "$GLOBALCONF" ]; then
LEVEL=`grep ^.debug= "$GLOBALCONF" | awk -F'"' '{ printf $2 }' 2> /dev/null` # debug
if [ ! -z $LEVEL ] && [ "$LEVEL" != "0" ]; then VAR=`grep ^.debug= "$GLOBALCONF" | awk -F'"' '{ printf $2 }' 2> /dev/null`
DEBUG="-l $LEVEL" if [ ! -z $VAR ] && [ "$VAR" != "0" ]; then
DEBUG="-l $VAR"
fi
# nft binary
VAR=`grep ^.nft_bin= "$GLOBALCONF" | awk -F'"' '{ printf $2 }' 2> /dev/null`
if [ ! -z $VAR ] && [ -e "$VAR" ]; then
NFTBIN="$VAR"
fi fi
fi fi


DESC="nftlb daemon service" DESC="nftlb daemon service"
NAME=nftlb NAME=nftlb
DAEMON=/usr/local/zevenet/app/nftlb/sbin/nftlb DAEMON=/usr/local/zevenet/app/nftlb/sbin/nftlb
DAEMON_ARGS="$DEBUG -H 127.0.0.1 -k HoLa -P 27" DAEMON_ARGS="$DEBUG -H 127.0.0.1 -k HoLa -P 27"
NFTBIN=`which nft`
PIDFILE=/var/run/$NAME.pid PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME SCRIPTNAME=/etc/init.d/$NAME


Expand All @@ -29,10 +36,12 @@ do_start()
} }


do_stop() { do_stop() {
`$NFTBIN flush ruleset`
start-stop-daemon --stop --signal 1 --quiet --remove-pidfile --pidfile $PIDFILE --name $NAME start-stop-daemon --stop --signal 1 --quiet --remove-pidfile --pidfile $PIDFILE --name $NAME
PID=`pidof nftlb`
[ -n "$PID" ] && kill -9 $PID
`$NFTBIN delete table ip nftlb 2> /dev/null`
`$NFTBIN delete table netdev nftlb 2> /dev/null`
[ -f $PIDFILE ] && rm -i $PIDFILE [ -f $PIDFILE ] && rm -i $PIDFILE
[ "$?" -ne 0 ] && return 2
} }


case "$1" in case "$1" in
Expand Down
3 changes: 2 additions & 1 deletion usr/local/zevenet/bin/zevenet
Expand Up @@ -512,7 +512,8 @@ if ( $action eq "stop" )


my $stop_nftlb = `/usr/local/zevenet/bin/nftlbd stop`; my $stop_nftlb = `/usr/local/zevenet/bin/nftlbd stop`;
my $status = `/usr/local/zevenet/bin/nftlbd status`; my $status = `/usr/local/zevenet/bin/nftlbd status`;
my $rtn_code = 0 if ( grep /nftlb is not running/, $status ); my $rtn_code = 1;
$rtn_code = 0 if ( grep /nftlb is not running/, $status );


if ( $rtn_code == 0 ) if ( $rtn_code == 0 )
{ {
Expand Down

0 comments on commit ab93a9a

Please sign in to comment.