Skip to content

Commit efc87cd

Browse files
author
Oleksii Tsvietnov
committed
Updated example
1 parent 0d3346e commit efc87cd

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

examples/service-discovery/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,31 @@ docker build -t trc-test-sd .
1717

1818
## Test
1919

20-
Press `<Ctrl+C>` to exit
20+
To test this example you need an IP of a working ZooKeeper cluster.
21+
The 'virtual app' can be interrupted by pressing `<Ctrl+C>`.
22+
23+
The command line will look like
24+
25+
```bash
26+
$ docker run --rm -it -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd
27+
```
28+
For example:
2129

2230
```bash
23-
$ docker run --rm -it -e RC_VERBOSE=true -e ZKURL="srv1[:port1][,srv2[:port2]...]" trc-test-sd
31+
$ 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
32+
2017-03-03 16:49:06 trc [main/1]: Launching on the boot: /etc/trc.d/boot.sd-reg
33+
2017-03-03 16:49:06 trc [main/1]: 2a3556e6f646 has been registered at 192.168.1.173
34+
2017-03-03 16:49:06 trc [sync/29]: Launching on the foreground: /etc/trc.d/sync.app
35+
I am alive! Press <Ctrl+C> to exit...
36+
I am alive! Press <Ctrl+C> to exit...
37+
I am alive! Press <Ctrl+C> to exit...
38+
^C2017-03-03 16:49:08 trc [sync/29]: Exiting on the foreground (exitcode=130): /etc/trc.d/sync.app
39+
2017-03-03 16:49:09 trc [main/1]: Trying to terminate sub-processes...
40+
2017-03-03 16:49:09 trc [halt/44]: Running the shutdown script: /etc/trc.d/halt.sd-unreg
41+
2017-03-03 16:49:09 trc [halt/44]: 2a3556e6f646 has been unregistered at 192.168.1.173
42+
2017-03-03 16:49:09 trc [main/1]: Exiting from the shutdown script (exitcode=0): /etc/trc.d/halt.sd-unreg
43+
2017-03-03 16:49:09 trc [main/1]: Exited.
44+
45+
$ echo $?
46+
0
2447
```

examples/service-discovery/trc.d/halt.sd-unreg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ then
77
log "$(hostname) has been unregistered at ${ZKURL}"
88
fi
99

10-
# finish with 0 exit status
10+
# Ignoring exit status 130 (after pressing Ctrl+C) by finishing with status 0
1111
exit 0

0 commit comments

Comments
 (0)