From efc87cd8dcb3d18ab20d6db63114388c0fc8be98 Mon Sep 17 00:00:00 2001 From: Oleksii Tsvietnov Date: Fri, 3 Mar 2017 17:50:49 +0100 Subject: [PATCH] Updated example --- examples/service-discovery/README.md | 27 +++++++++++++++++-- .../service-discovery/trc.d/halt.sd-unreg | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/examples/service-discovery/README.md b/examples/service-discovery/README.md index 79b3134..2fe424e 100644 --- a/examples/service-discovery/README.md +++ b/examples/service-discovery/README.md @@ -17,8 +17,31 @@ docker build -t trc-test-sd . ## Test -Press `` to exit +To test this example you need an IP of a working ZooKeeper cluster. +The 'virtual app' can be interrupted by pressing ``. + +The command line will look like + +```bash +$ docker run --rm -it -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd +``` +For example: ```bash -$ docker run --rm -it -e RC_VERBOSE=true -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd +$ docker run --rm -it -e ZKURL=192.168.1.173 trc-test-sd 2017-03-03 16:49:06 trc [main/1]: The wait policy: wait_any +2017-03-03 16:49:06 trc [main/1]: Launching on the boot: /etc/trc.d/boot.sd-reg +2017-03-03 16:49:06 trc [main/1]: 2a3556e6f646 has been registered at 192.168.1.173 +2017-03-03 16:49:06 trc [sync/29]: Launching on the foreground: /etc/trc.d/sync.app +I am alive! Press to exit... +I am alive! Press to exit... +I am alive! Press to exit... +^C2017-03-03 16:49:08 trc [sync/29]: Exiting on the foreground (exitcode=130): /etc/trc.d/sync.app +2017-03-03 16:49:09 trc [main/1]: Trying to terminate sub-processes... +2017-03-03 16:49:09 trc [halt/44]: Running the shutdown script: /etc/trc.d/halt.sd-unreg +2017-03-03 16:49:09 trc [halt/44]: 2a3556e6f646 has been unregistered at 192.168.1.173 +2017-03-03 16:49:09 trc [main/1]: Exiting from the shutdown script (exitcode=0): /etc/trc.d/halt.sd-unreg +2017-03-03 16:49:09 trc [main/1]: Exited. + +$ echo $? +0 ``` diff --git a/examples/service-discovery/trc.d/halt.sd-unreg b/examples/service-discovery/trc.d/halt.sd-unreg index 0cef2ee..ae35c60 100644 --- a/examples/service-discovery/trc.d/halt.sd-unreg +++ b/examples/service-discovery/trc.d/halt.sd-unreg @@ -7,5 +7,5 @@ then log "$(hostname) has been unregistered at ${ZKURL}" fi -# finish with 0 exit status +# Ignoring exit status 130 (after pressing Ctrl+C) by finishing with status 0 exit 0