mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 22:50:58 +00:00
35 lines
450 B
Bash
35 lines
450 B
Bash
|
|
#!/bin/sh
|
||
|
|
|
||
|
|
. /lib/functions.sh
|
||
|
|
. /usr/share/libubox/jshn.sh
|
||
|
|
|
||
|
|
readonly LOGREAD_CMD="logread -e ruantiblock:"
|
||
|
|
|
||
|
|
make_size_value() {
|
||
|
|
json_init
|
||
|
|
json_add_string 'bytes' "$1"
|
||
|
|
json_dump
|
||
|
|
json_cleanup
|
||
|
|
}
|
||
|
|
|
||
|
|
get_log_size() {
|
||
|
|
make_size_value "`$LOGREAD_CMD | wc -c`"
|
||
|
|
}
|
||
|
|
|
||
|
|
case "$1" in
|
||
|
|
list)
|
||
|
|
json_init
|
||
|
|
json_add_object "getLogSize"
|
||
|
|
json_close_object
|
||
|
|
json_dump
|
||
|
|
json_cleanup
|
||
|
|
;;
|
||
|
|
call)
|
||
|
|
case "$2" in
|
||
|
|
getLogSize)
|
||
|
|
get_log_size
|
||
|
|
;;
|
||
|
|
esac
|
||
|
|
;;
|
||
|
|
esac
|