From 782bcf693e4ddb598c4bc8cd6188b4a8f30a9b62 Mon Sep 17 00:00:00 2001 From: Sergey Kolomenkin Date: Thu, 30 Jan 2020 19:03:27 +0300 Subject: [PATCH] README: fix markdown formatting - limit line length (does not affect rendering) - add first-level header first - converted google domain from hyperlinks into plain text - add language specification for code fragments Here is a command to run Markdown syntax check: ``` docker run --rm --network none -v "/$PWD:/markdown:ro" 06kellyjac/markdownlint-cli:0.21.0-alpine //markdown ``` All the changes above fixed the following list of errors: ``` /markdown/README.md:1 MD041/first-line-heading/first-line-h1 First line in file should be a top level heading [Context: "## wait-for-it"] /markdown/README.md:3 MD013/line-length Line length [Expected: 80; Actual: 280] /markdown/README.md:7 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] /markdown/README.md:21 MD013/line-length Line length [Expected: 80; Actual: 131] /markdown/README.md:23 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] /markdown/README.md:30 MD013/line-length Line length [Expected: 80; Actual: 124] /markdown/README.md:32 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] /markdown/README.md:39 MD013/line-length Line length [Expected: 80; Actual: 239] /markdown/README.md:41 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] /markdown/README.md:48 MD013/line-length Line length [Expected: 80; Actual: 185] /markdown/README.md:50 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"] ``` --- README.md | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4891736..d08d5a2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ -## wait-for-it +# wait-for-it -`wait-for-it.sh` is a pure bash script that will wait on the availability of a host and TCP port. It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers. Since it is a pure bash script, it does not have any external dependencies. +`wait-for-it.sh` is a pure bash script that will wait on the availability of a +host and TCP port. It is useful for synchronizing the spin-up of +interdependent services, such as linked docker containers. Since it is a pure +bash script, it does not have any external dependencies. ## Usage -``` +```text wait-for-it.sh host:port [-s] [-t timeout] [-- command args] -h HOST | --host=HOST Host or IP under test -p PORT | --port=PORT TCP port under test @@ -18,36 +21,43 @@ wait-for-it.sh host:port [-s] [-t timeout] [-- command args] ## Examples -For example, let's test to see if we can access port 80 on www.google.com, and if it is available, echo the message `google is up`. +For example, let's test to see if we can access port 80 on `www.google.com`, +and if it is available, echo the message `google is up`. -``` +```text $ ./wait-for-it.sh www.google.com:80 -- echo "google is up" wait-for-it.sh: waiting 15 seconds for www.google.com:80 wait-for-it.sh: www.google.com:80 is available after 0 seconds google is up ``` -You can set your own timeout with the `-t` or `--timeout=` option. Setting the timeout value to 0 will disable the timeout: +You can set your own timeout with the `-t` or `--timeout=` option. Setting +the timeout value to 0 will disable the timeout: -``` +```text $ ./wait-for-it.sh -t 0 www.google.com:80 -- echo "google is up" wait-for-it.sh: waiting for www.google.com:80 without a timeout wait-for-it.sh: www.google.com:80 is available after 0 seconds google is up ``` -The subcommand will be executed regardless if the service is up or not. If you wish to execute the subcommand only if the service is up, add the `--strict` argument. In this example, we will test port 81 on www.google.com which will fail: +The subcommand will be executed regardless if the service is up or not. If you +wish to execute the subcommand only if the service is up, add the `--strict` +argument. In this example, we will test port 81 on `www.google.com` which will +fail: -``` +```text $ ./wait-for-it.sh www.google.com:81 --timeout=1 --strict -- echo "google is up" wait-for-it.sh: waiting 1 seconds for www.google.com:81 wait-for-it.sh: timeout occurred after waiting 1 seconds for www.google.com:81 wait-for-it.sh: strict mode, refusing to execute subprocess ``` -If you don't want to execute a subcommand, leave off the `--` argument. This way, you can test the exit condition of `wait-for-it.sh` in your own scripts, and determine how to proceed: +If you don't want to execute a subcommand, leave off the `--` argument. This +way, you can test the exit condition of `wait-for-it.sh` in your own scripts, +and determine how to proceed: -``` +```text $ ./wait-for-it.sh www.google.com:80 wait-for-it.sh: waiting 15 seconds for www.google.com:80 wait-for-it.sh: www.google.com:80 is available after 0 seconds