summaryrefslogtreecommitdiffstats
path: root/base/root/scripts/nsd_server_common.bash
diff options
context:
space:
mode:
Diffstat (limited to 'base/root/scripts/nsd_server_common.bash')
-rw-r--r--base/root/scripts/nsd_server_common.bash18
1 files changed, 18 insertions, 0 deletions
diff --git a/base/root/scripts/nsd_server_common.bash b/base/root/scripts/nsd_server_common.bash
new file mode 100644
index 0000000..d665c59
--- /dev/null
+++ b/base/root/scripts/nsd_server_common.bash
@@ -0,0 +1,18 @@
+# If there are sofs_storage nodes in the cluster (meaning that other
+# sofs_* nodes will not have direct-attached storage) then scripts
+# that include this snippet must be run on one of the storage nodes.
+# Therefore, in the case, this snippet tries to determine if it is
+# running on the 1st NSD server and, if not, attempts to run the
+# script there.
+
+nsd_servers="@@NSD_SERVERS@@"
+
+if [ -n "$nsd_servers" -a \
+ "${HOSTNAME%%.*}" != "${nsd_servers%%[.,]*}" ] ; then
+ if [ "${0#/}" != "$0" ] ; then
+ script="$0"
+ else
+ script="${PWD}/${0}"
+ fi
+ exec ssh "${nsd_servers%%[.,]*}" "$script" "$@"
+fi