#!/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