summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-03-03 12:49:08 +0100
committerLinus Nordberg <linus@nordu.net>2017-03-03 12:49:08 +0100
commitfef1037331445d80c3cb19c3d420015d79b568eb (patch)
treee188184812d0c733e81d9395da367f0358219de8
parent5b90e6cc436806396537c689d1c1a469ced9c75b (diff)
Add update-config.sh and have it update once per hour.
-rw-r--r--catlfish-dev/Dockerfile3
-rwxr-xr-xcatlfish-dev/start.sh11
-rw-r--r--catlfish-dev/update-config.sh12
3 files changed, 24 insertions, 2 deletions
diff --git a/catlfish-dev/Dockerfile b/catlfish-dev/Dockerfile
index c07fd4e..1689941 100644
--- a/catlfish-dev/Dockerfile
+++ b/catlfish-dev/Dockerfile
@@ -80,10 +80,11 @@ RUN useradd --uid 147 --gid 147 catlfish
RUN mkdir /var/run/catlfish
WORKDIR /var/run/catlfish
-RUN mkdir erlang_log sasl_log merge_log
+RUN mkdir erlang_log sasl_log merge_log update_conf_log
RUN chown -R catlfish:catlfish /var/run/catlfish
ADD merge.sh /usr/local/catlfish/
+ADD update-config.sh /usr/local/catlfish/
ADD start.sh /var/run/catlfish/
USER catlfish
ENTRYPOINT ["/var/run/catlfish/start.sh"]
diff --git a/catlfish-dev/start.sh b/catlfish-dev/start.sh
index 9265210..a494184 100755
--- a/catlfish-dev/start.sh
+++ b/catlfish-dev/start.sh
@@ -16,8 +16,12 @@ erlbase=$ERLANG_BASE_DIR
# source code to be unpacked in the container.
GETCONFIG=/usr/local/catlfish/src/tools/getconfig.sh
+LOCALCONF=/usr/local/etc/catlfish/${nodename}.cfg
+GLOBALCONF=${logname}.cfg
+PLOPCONTROL=${nodename}.plopcontrol
+
mkdir ${nodename}
-$GETCONFIG /usr/local/etc/catlfish/${nodename}.cfg ${logname}.cfg force-compile
+${GETCONFIG} ${LOCALCONF} ${GLOBALCONF} force-compile
ln -s ${nodename}/${nodename}.config
case $role in
@@ -39,6 +43,11 @@ case $role in
;;
esac
+$erlbase/update-config.sh 3600 \
+ ${GETCONFIG} ${LOCALCONF} ${GLOBALCONF} ${PLOPCONTROL} \
+ > update_conf_log/stdout \
+ 2> update_conf_log/stderr &
+
$erlbase/bin/run_erl \
/var/run/catlfish/ \
/var/run/catlfish/erlang_log/ \
diff --git a/catlfish-dev/update-config.sh b/catlfish-dev/update-config.sh
new file mode 100644
index 0000000..1fad2b0
--- /dev/null
+++ b/catlfish-dev/update-config.sh
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+interval="$1"; [ -n "$1" ] && shift
+getconfig="$1"; [ -n "$1" ] && shift
+localconf="$1"; [ -n "$1" ] && shift
+globalconf="$1"; [ -n "$1" ] && shift
+plopcontrol="$1"; [ -n "$1" ] && shift
+
+while true; do
+ sleep ${interval}
+ ${getconfig} ${localconf} ${globalconf} ${plopcontrol}
+done