mwan3: move mwan3_init call in mwwan3track into main
authorFlorian Eckert <fe@dev.tdt.de>
Wed, 4 Nov 2020 10:40:45 +0000 (11:40 +0100)
committerFlorian Eckert <fe@dev.tdt.de>
Fri, 6 Nov 2020 09:35:45 +0000 (10:35 +0100)
Initialize TRACK_OUTPUT has been set after INTERFACE variable initialization.
Move definition into main fixes this issue.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
net/mwan3/files/usr/sbin/mwan3track

index d97933e09ba3378d4f2261cbeca10e43da7e5800..1cd9e97faa95eeb23b171bda252ca6edce8e1e15 100755 (executable)
@@ -9,9 +9,6 @@ DEVICE=""
 
 IFDOWN_EVENT=0
 IFUP_EVENT=0
-TRACK_OUTPUT=$MWAN3TRACK_STATUS_DIR/$INTERFACE/TRACK_OUTPUT
-
-mwan3_init
 
 stop_subprocs() {
        [ -n "$SLEEP_PID" ] && kill "$SLEEP_PID" && unset SLEEP_PID
@@ -169,6 +166,10 @@ main() {
        INTERFACE=$1
        STATUS=""
        STARTED=0
+       TRACK_OUTPUT=$MWAN3TRACK_STATUS_DIR/$INTERFACE/TRACK_OUTPUT
+
+       mwan3_init
+
        mkdir -p $MWAN3TRACK_STATUS_DIR/$INTERFACE
 
        trap clean_up TERM