summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-08-30 07:52:40 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-08-30 07:52:40 +0000
commitc620e1128d8c6a48d74467e671575c1c55b3a608 (patch)
tree2906a31317704c5f5931767923a1655bdc01643e
parent504b597d16e3b0471901e01964fcd229dd3f947e (diff)
downloadvyatta-op-c620e1128d8c6a48d74467e671575c1c55b3a608.tar.gz
vyatta-op-c620e1128d8c6a48d74467e671575c1c55b3a608.zip
add command 'clear dns forwarding process' to restart dnsmasq and clear all statistics
-rw-r--r--scripts/vyatta-op-dns-forwarding.pl7
-rw-r--r--templates/clear/dns/forwarding/process/node.def8
2 files changed, 14 insertions, 1 deletions
diff --git a/scripts/vyatta-op-dns-forwarding.pl b/scripts/vyatta-op-dns-forwarding.pl
index c53c7a0..6ef8ebb 100644
--- a/scripts/vyatta-op-dns-forwarding.pl
+++ b/scripts/vyatta-op-dns-forwarding.pl
@@ -213,9 +213,10 @@ sub print_nameservers {
#
# main
#
-my ($clear_cache, $show_statistics, $show_nameservers);
+my ($clear_cache, $clear_process, $show_statistics, $show_nameservers);
GetOptions("clear-cache!" => \$clear_cache,
+ "clear-process!" => \$clear_process,
"show-statistics!" => \$show_statistics,
"show-nameservers!" => \$show_nameservers);
@@ -223,6 +224,10 @@ if (defined $clear_cache) {
system("kill -1 `pidof dnsmasq`");
}
+if (defined $clear_process) {
+ system("/etc/init.d/dnsmasq restart >&/dev/null");
+}
+
if (defined $show_statistics) {
system("echo > /var/log/dnsmasq.log; kill -10 `pidof dnsmasq`");
get_cache_stats;
diff --git a/templates/clear/dns/forwarding/process/node.def b/templates/clear/dns/forwarding/process/node.def
new file mode 100644
index 0000000..20427cb
--- /dev/null
+++ b/templates/clear/dns/forwarding/process/node.def
@@ -0,0 +1,8 @@
+help: Clear DNS forwarding process
+run:
+ if ps ax | grep dnsmasq | grep -v grep > /dev/null
+ then
+ sudo /opt/vyatta/bin/sudo-users/vyatta-op-dns-forwarding.pl --clear-process
+ else
+ echo "DNS forwarding not configured"
+ fi