Squashed 'luci-app-smartdns/' content from commit f5a370f

git-subtree-dir: luci-app-smartdns
git-subtree-split: f5a370f67fdc034738edf4aeb80604fd3df3b1ed
This commit is contained in:
bgme 2025-05-10 00:16:44 +08:00
commit f0353c7f4a
13 changed files with 8229 additions and 0 deletions

24
root/usr/libexec/smartdns-call Executable file
View file

@ -0,0 +1,24 @@
#!/bin/sh
#
# Copyright 2018-2025 Nick Peng <zxlhhyccc@gmail.com>
# Licensed to the public under the GPL V3 License.
action=$1
shift
log_file="$(uci -q get smartdns.@smartdns[0].log_file)"
list_file="${log_file:-/var/log/smartdns/smartdns.log}"
case "$action" in
tail)
if [ ! -e "$list_file" ]; then
echo "Log file does not exist."
fi
# read log
tail -n 5000 "$list_file"
;;
clear_log)
# clear log
> $list_file
;;
esac