You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
720 B
Bash
43 lines
720 B
Bash
4 years ago
|
#!/bin/sh
|
||
|
|
||
|
. /lib/functions.sh
|
||
|
. /usr/share/libubox/jshn.sh
|
||
|
|
||
|
_logger() {
|
||
|
/usr/bin/logger -t configsync_vs_handler.sh: "$@"
|
||
|
}
|
||
|
|
||
|
service_quota() {
|
||
|
local EVENT=$1
|
||
|
local MAC=$2
|
||
|
local REMAINING=$3
|
||
|
case $EVENT in
|
||
|
assoc|disassoc)
|
||
|
/usr/bin/station_quota.sh --event "${EVENT}_remote" --mac "${MAC}" --remaining "${REMAINING}"
|
||
|
;;
|
||
|
list)
|
||
|
/usr/bin/station_quota.sh --event "${EVENT}_remote"
|
||
|
;;
|
||
|
*)
|
||
|
_logger "unknown event '$EVENT'"
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
json_init
|
||
|
json_load "$1"
|
||
|
json_get_var service service
|
||
|
json_get_var event event
|
||
|
json_get_var mac mac
|
||
|
json_get_var remaining remaining
|
||
|
json_dump
|
||
|
|
||
|
case $service in
|
||
|
quota)
|
||
|
service_quota $event $mac $remaining
|
||
|
;;
|
||
|
*)
|
||
|
_logger "unknown service '$service'"
|
||
|
;;
|
||
|
esac
|