luci-app-mosdns: Add logs print support for "custom configuration"
This commit is contained in:
parent
ed1bba13e4
commit
ad77fbee68
@ -26,9 +26,9 @@ function act_status()
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec("[ -f $(uci -q get mosdns.mosdns.logfile) ] && cat $(uci -q get mosdns.mosdns.logfile)"))
|
||||
luci.http.write(luci.sys.exec("cat $(/usr/share/mosdns/log_path.sh)"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("cat /dev/null > $(uci -q get mosdns.mosdns.logfile)")
|
||||
luci.sys.call("cat /dev/null > $(/usr/share/mosdns/log_path.sh)")
|
||||
end
|
||||
|
@ -81,7 +81,7 @@ start_service() {
|
||||
delcron
|
||||
setcron
|
||||
init_yaml
|
||||
cat /dev/null > $(uci -q get mosdns.mosdns.logfile)
|
||||
cat /dev/null > $(/usr/share/mosdns/log_path.sh)
|
||||
procd_open_instance mosdns
|
||||
procd_set_param command $PROG start -c "$CONF"
|
||||
procd_set_param user root
|
||||
|
9
luci-app-mosdns/root/usr/share/mosdns/log_path.sh
Executable file
9
luci-app-mosdns/root/usr/share/mosdns/log_path.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
configfile=$(uci -q get mosdns.mosdns.configfile)
|
||||
if [ "$configfile" = "/etc/mosdns/config.yaml" ]; then
|
||||
uci -q get mosdns.mosdns.logfile
|
||||
else
|
||||
[ ! -f /etc/mosdns/config_custom.yaml ] && exit 1
|
||||
cat /etc/mosdns/config_custom.yaml | grep -A 3 log | grep file | awk -F ":" '{print $2}' | sed 's/\"//g;s/ //g'
|
||||
fi
|
Loading…
Reference in New Issue
Block a user