summaryrefslogtreecommitdiffstats
path: root/libexec/fence/functions
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/fence/functions')
-rwxr-xr-xlibexec/fence/functions/exist7
-rwxr-xr-xlibexec/fence/functions/start8
-rwxr-xr-xlibexec/fence/functions/status14
-rwxr-xr-xlibexec/fence/functions/stop8
4 files changed, 37 insertions, 0 deletions
diff --git a/libexec/fence/functions/exist b/libexec/fence/functions/exist
new file mode 100755
index 0000000..183b5c4
--- /dev/null
+++ b/libexec/fence/functions/exist
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+NAME="${@}"
+
+sudo cnt list -f sh | grep -q "^${NAME}"
diff --git a/libexec/fence/functions/start b/libexec/fence/functions/start
new file mode 100755
index 0000000..b71cd1b
--- /dev/null
+++ b/libexec/fence/functions/start
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+NAME="${@}"
+
+sudo cnt start -n ${NAME} 2> /dev/null
+exit $?
diff --git a/libexec/fence/functions/status b/libexec/fence/functions/status
new file mode 100755
index 0000000..03eaed2
--- /dev/null
+++ b/libexec/fence/functions/status
@@ -0,0 +1,14 @@
+#!/bin/sh -x
+
+set -e
+
+NAME="${@}"
+
+if sudo cnt list -f sh -s | grep -qs "^${NAME}"
+then
+ CNT_STATUS="started"
+else
+ CNT_STATUS="stopped"
+fi
+
+export CNT_STATUS=${CNT_STATUS}
diff --git a/libexec/fence/functions/stop b/libexec/fence/functions/stop
new file mode 100755
index 0000000..5db1616
--- /dev/null
+++ b/libexec/fence/functions/stop
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+NAME="${@}"
+
+sudo cnt stop -n ${NAME}
+exit $?