diff options
author | startxfr <clarue@startx.fr> | 2016-02-06 05:05:57 +0100 |
---|---|---|
committer | startxfr <clarue@startx.fr> | 2016-02-06 05:05:57 +0100 |
commit | 5cff390c081bdfb756a8977ad0bd56d778202d6b (patch) | |
tree | ce018b9be9ad054e4f7aa6891d7b4668c1ad74af /Services/couchbase/run.sh | |
parent | 0f3bcf30ae748a75c22a03d4655dba4d8dc71185 (diff) | |
download | phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.gz phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.bz2 phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.tar.xz phpmyadmin-5cff390c081bdfb756a8977ad0bd56d778202d6b.zip |
reorg avec gestion des sig
Diffstat (limited to 'Services/couchbase/run.sh')
-rw-r--r-- | Services/couchbase/run.sh | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/Services/couchbase/run.sh b/Services/couchbase/run.sh index 4794ee0..2f6f655 100644 --- a/Services/couchbase/run.sh +++ b/Services/couchbase/run.sh @@ -42,22 +42,34 @@ function end_config { echo "=> END COUCHBASE CONFIGURATION" } +function stop_couchbase_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 +} + # Start the couchbase server as a deamon and execute it inside # the running shell -function start_daemon { - echo "=> Starting couchbase daemon ..." | tee -a $STARTUPLOG - display_container_started | tee -a $STARTUPLOG +function start_service_couchbase { + trap 'kill ${!}; stop_couchbase_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 # exec couchbase -u daemon -v -exec tail -f /etc/redhat-release + exec tail -f /dev/null & + while true + do + tail -f /dev/null & wait ${!} + done } - -if [[ "$0" == *"run.sh" && ! $1 = "" ]];then - eval "$@"; -fi - check_environment | tee -a $STARTUPLOG display_container_couchbase_header | tee -a $STARTUPLOG begin_config | tee -a $STARTUPLOG end_config | tee -a $STARTUPLOG -start_daemon +start_service_couchbase |