added syslog

This commit is contained in:
wt
2024-07-03 10:05:16 +07:00
parent 829a98d76b
commit f2c3880982
14 changed files with 55 additions and 4 deletions
+3
View File
@@ -3,6 +3,7 @@
#include <json.hpp>
#include "../../routes.hpp"
#include "../../types.hpp"
#include <syslog.h>
#define DNS_REQUIRED_STRING R"({"required":"[token,enabled]"})"
@@ -78,9 +79,11 @@ void set_dns(const httplib::Request &request, httplib::Response &response) {
if (new_dns_enabled == "0") {
system("/etc/init.d/dnsmasq stop");
system("rm /etc/rc.d/60dnsmasq");
syslog(LOG_INFO, "DNS is disabled");
} else {
system("/etc/init.d/dnsmasq restart");
system("ln -sv /etc/init.d/dnsmasq /etc/rc.d/60dnsmasq");
syslog(LOG_INFO, "DNS is enabled");
}
dnsfileout << stoi(new_dns_enabled);
dnsfileout.close();