summaryrefslogtreecommitdiff
path: root/tools/getconfig.sh
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2017-02-02 16:08:24 +0100
committerMagnus Ahltorp <map@kth.se>2017-02-02 21:58:38 +0100
commit8a1f3a5f5b1458aceb7567add95e7637e9c2e5fc (patch)
tree188f039cce63266dbe0dcca0477ca63bc983e74d /tools/getconfig.sh
parentf481bd4f30a00fa3d4a5b4aecd0f881b1f5b58f5 (diff)
Added tools for getting and generating global config
Diffstat (limited to 'tools/getconfig.sh')
-rwxr-xr-xtools/getconfig.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/getconfig.sh b/tools/getconfig.sh
new file mode 100755
index 0000000..f73cf1b
--- /dev/null
+++ b/tools/getconfig.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# usage: getconfig.sh <localconfig> <globalconfig> <plopcontrolfile>
+
+set -o nounset
+set -o errexit
+
+BINDIR=$(dirname $0)
+
+localconfig=$1
+globalconfig=$2
+plopcontrolfile=$3
+
+plopcontrolport=$(cat ${plopcontrolfile})
+configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport})
+echo "version before reload: $configversion"
+getconfigresult=$(${BINDIR}/getconfig.py --localconfig ${localconfig} --dest ${globalconfig})
+if [ "$getconfigresult" == "newconfig" ]; then
+ ${BINDIR}/compileconfig.py --localconfig ${localconfig} --config ${globalconfig}
+ reloadresult=$(echo "reload" | nc 127.0.0.1 ${plopcontrolport})
+ echo $reloadresult
+ if [ "$reloadresult" != "reload completed" ]; then
+ exit 1
+ fi
+ configversion=$(echo "configversion" | nc 127.0.0.1 ${plopcontrolport})
+ echo "version after reload: $configversion"
+else
+ echo "reload not needed"
+fi