summaryrefslogtreecommitdiff
path: root/templates/restart/dns/forwarding/node.def
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-11-21 09:33:14 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-11-21 09:57:21 +0000
commitcfec488a33e45606b1285a073a93aa69f935d8ae (patch)
treeb99cfd266f6680ce6d41d764c549366c79249273 /templates/restart/dns/forwarding/node.def
parent6b8e2a100d2864adcdc309d08b91ecbb22c83403 (diff)
downloadvyatta-op-cfec488a33e45606b1285a073a93aa69f935d8ae.tar.gz
vyatta-op-cfec488a33e45606b1285a073a93aa69f935d8ae.zip
vyatta-op: add "check if service is configured" to restart commands
Add a check to the recent service restart CLI command additions to ensure they are currently configured before allowing a restart. Bug #514 http://bugzilla.vyos.net/show_bug.cgi?id=514
Diffstat (limited to 'templates/restart/dns/forwarding/node.def')
-rw-r--r--templates/restart/dns/forwarding/node.def15
1 files changed, 9 insertions, 6 deletions
diff --git a/templates/restart/dns/forwarding/node.def b/templates/restart/dns/forwarding/node.def
index b66ab3c..5740ebf 100644
--- a/templates/restart/dns/forwarding/node.def
+++ b/templates/restart/dns/forwarding/node.def
@@ -1,9 +1,12 @@
help: Restart DNS forwarding
run:
- echo "Restarting DNS forwarding..."
- sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --restart-dnsforwarding;
- if [[ $? -eq 0 ]]; then
- echo "Success!"
- fi
-
+ if cli-shell-api existsActive service dns forwarding; then
+ echo "Restarting DNS forwarding..."
+ sudo /opt/vyatta/sbin/vyatta-dns-forwarding.pl --restart-dnsforwarding;
+ if [[ $? -eq 0 ]]; then
+ echo "Success!"
+ fi
+ else
+ echo "DNS forwarding is not configured"
+ fi