|
@@ -13,29 +13,39 @@ STOP=
|
13
|
13
|
ACTIVE_STATE_PREFIX="SQM_active_on_"
|
14
|
14
|
ACTIVE_STATE_FILE_DIR="/var/run/SQM"
|
15
|
15
|
mkdir -p ${ACTIVE_STATE_FILE_DIR}
|
16
|
|
-PROTO_STATE_FILE_LIST=$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}* 2> /dev/null )
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+START_ON_IF=$2 # only process this interface
|
|
19
|
+# TODO if $2 is empty select all interfaces with running sqm instance
|
|
20
|
+if [ -z ${START_ON_IF} ] ;
|
|
21
|
+then
|
|
22
|
+ # find all interfaces with active sqm instance
|
|
23
|
+ logger -t SQM -s "Trying to start/stop SQM on all interfaces."
|
|
24
|
+ PROTO_STATE_FILE_LIST=$( ls ${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}* 2> /dev/null )
|
|
25
|
+else
|
|
26
|
+ # only try to restart the just hotplugged interface, so reduce the list of interfaces to stop to the specified one
|
|
27
|
+ logger -t SQM -s "Trying to start/stop SQM on interface ${START_ON_IF}"
|
|
28
|
+ PROTO_STATE_FILE_LIST=${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}${START_ON_IF}
|
|
29
|
+fi
|
|
30
|
+
|
|
31
|
+
|
17
|
32
|
|
18
|
33
|
|
19
|
34
|
case ${1} in
|
|
35
|
+ start)
|
|
36
|
+ # just run through, same as passing no argument
|
|
37
|
+ ;;
|
20
|
38
|
stop)
|
21
|
39
|
logger -t SQM -s "run.sh stop"
|
22
|
40
|
STOP=$1
|
23
|
41
|
;;
|
24
|
|
- interface)
|
25
|
|
- START_ON_IF=$2 # only process this interface
|
26
|
|
- logger -t SQM -s "Trying to re-start SQM on interface ${START_ON_IF}"
|
27
|
|
- # TODO if $2 is empty just bail...
|
28
|
|
- if [ -z ${START_ON_IF} ] ;
|
29
|
|
- then
|
30
|
|
- logger -t SQM -s "Interface name missing, nothing to do, bailing out"
|
31
|
|
- return 0
|
32
|
|
- fi
|
33
|
|
- # only try to restart the just hotplugged interface, so reduce the list of interfaces to stop to the specified one
|
34
|
|
- PROTO_STATE_FILE_LIST=${ACTIVE_STATE_FILE_DIR}/${ACTIVE_STATE_PREFIX}${START_ON_IF}
|
35
|
|
- ;;
|
36
|
42
|
esac
|
37
|
43
|
|
38
|
44
|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
39
|
49
|
# the current uci config file does not necessarily contain sections for all interfaces with active
|
40
|
50
|
# SQM instances, so use the ACTIVE_STATE_FILES to detect the interfaces on which to stop SQM.
|
41
|
51
|
# Currently the .qos scripts start with stopping any existing traffic shaping so this should not
|