Add coredump feature and print PC

This commit is contained in:
Nick Peng
2018-12-30 23:19:52 +08:00
parent 82db995bc1
commit d6c67edb1e
5 changed files with 38 additions and 5 deletions

View File

@@ -16,6 +16,12 @@ msgstr "SmartDNS是一个本地高性能DNS服务器支持避免域名污染
msgid "Custom Settings"
msgstr "自定义设置"
msgid "Generate Coredump"
msgstr "生成coredump"
msgid "Generate Coredump file when smartdns crash, coredump file is located at /tmp/smartdns.xxx.core."
msgstr "当smartdns异常时生成coredump文件coredump文件在/tmp/smartdns.xxx.core."
msgid "Server Name"
msgstr "服务器名称"

View File

@@ -103,6 +103,13 @@ function custom.write(self, section, value)
nixio.fs.writefile("/etc/smartdns/custom.conf", value)
end
o = s:taboption("custom", Flag, "coredump", translate("Generate Coredump"), translate("Generate Coredump file when smartdns crash, coredump file is located at /tmp/smartdns.xxx.core."))
o.rmempty = false
o.default = o.disabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
-- Upstream servers
s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("Upstream Servers, support UDP, TCP protocol. " ..
"Please configure multiple DNS servers, including multiple foreign DNS servers."))

View File

@@ -174,6 +174,11 @@ start_service() {
conf_append "server-name" "$server_name"
fi
config_get "coredump" "$section" "coredump" "0"
if [ "$coredump" = "1" ]; then
COREDUMP="1"
fi
config_get "port" "$section" "port" "6053"
config_get "ipv6_server" "$section" "ipv6_server" "1"
config_get "tcp_server" "$section" "tcp_server" "1"
@@ -270,7 +275,7 @@ start_service() {
echo "conf-file $BLACKLIST_IP_CONF" >> $SMARTDNS_CONF_TMP
echo "conf-file $CUSTOM_CONF" >> $SMARTDNS_CONF_TMP
mv $SMARTDNS_CONF_TMP $SMARTDNS_CONF
if [ "$COREDUMP" = "1" ]; then
args="$args -S"
ulimit -c unlimited