diff options
author | startxfr <clarue@startx.fr> | 2016-02-06 02:53:52 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2016-02-06 02:53:52 +0100 |
commit | 0f3bcf30ae748a75c22a03d4655dba4d8dc71185 (patch) | |
tree | ae032e55c35e41576e13d46ebb82d58c0966ef15 | |
parent | 05a6fe72c04bd785fa289b7b5fd9bc8f871ea3a1 (diff) | |
download | phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.gz phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.bz2 phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.tar.xz phpmyadmin-0f3bcf30ae748a75c22a03d4655dba4d8dc71185.zip |
modif de conf OS
-rw-r--r-- | OS/Dockerfile | 8 | ||||
-rw-r--r-- | OS/docker-compose.yml | 4 | ||||
-rw-r--r-- | OS/run.sh | 7 | ||||
-rw-r--r-- | OS/sx-lib.sh | 31 |
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 @@ -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 +} |