summaryrefslogtreecommitdiff
path: root/templates/restart/ssh/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/ssh/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/ssh/node.def')
-rw-r--r--templates/restart/ssh/node.def15
1 files changed, 9 insertions, 6 deletions
diff --git a/templates/restart/ssh/node.def b/templates/restart/ssh/node.def
index c8f59a9..1fa1aff 100644
--- a/templates/restart/ssh/node.def
+++ b/templates/restart/ssh/node.def
@@ -1,9 +1,12 @@
help: Restart SSH service
run:
- echo "Restarting SSH..."
- sudo /usr/sbin/invoke-rc.d ssh restart
- if [[ $? -eq 0 ]]; then
- echo "Success!"
- fi
-
+ if cli-shell-api existsActive service ssh; then
+ echo "Restarting SSH..."
+ sudo /usr/sbin/invoke-rc.d ssh restart
+ if [[ $? -eq 0 ]]; then
+ echo "Success!"
+ fi
+ else
+ echo "SSH is not configured"
+ fi