summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstartxfr <clarue@startx.fr>2016-02-06 02:53:52 +0100
committerstartxfr <clarue@startx.fr>2016-02-06 02:53:52 +0100
commit0f3bcf30ae748a75c22a03d4655dba4d8dc71185 (patch)
treeae032e55c35e41576e13d46ebb82d58c0966ef15
parent05a6fe72c04bd785fa289b7b5fd9bc8f871ea3a1 (diff)
downloadphpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.gz
phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.bz2
phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.xz
phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.zip
modif de conf OS
-rw-r--r--OS/Dockerfile8
-rw-r--r--OS/docker-compose.yml4
-rw-r--r--OS/run.sh7
-rw-r--r--OS/sx-lib.sh31
4 files changed, 36 insertions, 14 deletions
diff --git a/OS/Dockerfile b/OS/Dockerfile
index da351a2..82c9a7a 100644
--- a/OS/Dockerfile
+++ b/OS/Dockerfile
@@ -7,10 +7,12 @@ RUN dnf -y install deltarpm pwgen tar python-dnf-plugins-extras-migrate && \
dnf-2 migrate && \
dnf -y install psmisc procps coreutils findutils iputils net-tools wget logrotate zip && \
dnf clean all
+ENV STARTUPLOG=/logs/startup.log \
+ LOG_PATH=/logs
COPY *.sh /bin/
RUN chmod 775 /bin/sx-lib.sh /bin/run.sh && \
- mkdir /data && \
- mkdir /data/logs
-ENV TERM=xterm
+ mkdir /data /logs && \
+ touch $STARTUPLOG
+VOLUME [$LOG_PATH]
CMD ["/bin/run.sh"]
diff --git a/OS/docker-compose.yml b/OS/docker-compose.yml
index b062fc8..bd30b96 100644
--- a/OS/docker-compose.yml
+++ b/OS/docker-compose.yml
@@ -8,4 +8,6 @@ fedora:
environment:
CONTAINER_TYPE: "os"
CONTAINER_SERVICE: "fedora"
- CONTAINER_INSTANCE: "os-fedora" \ No newline at end of file
+ CONTAINER_INSTANCE: "os-fedora"
+ volumes:
+ - "/tmp/container/logs/fedora:/logs" \ No newline at end of file
diff --git a/OS/run.sh b/OS/run.sh
index 13a5bd4..e491694 100644
--- a/OS/run.sh
+++ b/OS/run.sh
@@ -1,7 +1,6 @@
#!/bin/bash
source /bin/sx-lib.sh
-check_environment
-display_container_header
-display_container_started
-tail -f /etc/redhat-release \ No newline at end of file
+check_environment | tee -a $STARTUPLOG
+display_container_header | tee -a $STARTUPLOG
+start_service \ No newline at end of file
diff --git a/OS/sx-lib.sh b/OS/sx-lib.sh
index 0df6f9c..3d9691a 100644
--- a/OS/sx-lib.sh
+++ b/OS/sx-lib.sh
@@ -1,6 +1,7 @@
#!/bin/bash
-export TERM=dumb
+export TERM=xterm
+pid=0
function check_environment {
if [ ! -v CONTAINER_TYPE ]; then
@@ -39,8 +40,26 @@ function display_container_header {
echo "+====================================================="
}
-function display_container_started {
- echo "+====================================================="
- echo "| Container $HOSTNAME is now running..."
- echo "+====================================================="
-} \ No newline at end of file
+function stop_handler {
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ echo "| Container $HOSTNAME is now STOPPED" | tee -a $STARTUPLOG
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ if [ $pid -ne 0 ]; then
+ kill -SIGTERM "$pid"
+ wait "$pid"
+ fi
+ exit 143; # 128 + 15 -- SIGTERM
+}
+
+function start_service {
+ trap 'kill ${!}; stop_handler' SIGHUP SIGINT SIGQUIT SIGTERM SIGKILL SIGSTOP SIGCONT
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ echo "| Container $HOSTNAME is now RUNNING" | tee -a $STARTUPLOG
+ echo "+=====================================================" | tee -a $STARTUPLOG
+ tail -f /dev/null &
+ pid="$!"
+ while true
+ do
+ tail -f /dev/null & wait ${!}
+ done
+}