summaryrefslogtreecommitdiff
path: root/tools/getconfig.sh
blob: aaab7ee3a2a1a0bf6721741e2487b05549f66403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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