https://github.com/andreiavrammsd/wait-for-it
Run a command only when port on host is available
https://github.com/andreiavrammsd/wait-for-it
alpine docker linux ubuntu wait-for-it
Last synced: 3 months ago
JSON representation
Run a command only when port on host is available
- Host: GitHub
- URL: https://github.com/andreiavrammsd/wait-for-it
- Owner: andreiavrammsd
- License: mit
- Created: 2016-12-27T21:35:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-26T08:14:25.000Z (over 5 years ago)
- Last Synced: 2025-01-03T18:12:18.398Z (5 months ago)
- Topics: alpine, docker, linux, ubuntu, wait-for-it
- Language: Shell
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Wait for it
## Run a command only when port on host is available
### Tested on Alpine and Ubuntu
I needed to run a command in an Alpine Docker container only after another process (from other container) was open.
Based on https://github.com/vishnubob/wait-for-it. Many thanks!
Uses: https://en.wikipedia.org/wiki/Netcat
#### Setup
* chmod +x wait-for-it.sh
* Change shebang line as needed:
* Alpine: #!/usr/bin/env sh
* Ubuntu: #!/usr/bin/env bash#### Usage
```
./wait-for-it.sh -h host -p port [-c command] [-t timeout] [-q quiet]
-h Host or IP under test
-p TCP port under test
-c Command to execute if test succeeds
-t Timeout in seconds, zero for no timeout
-q Don't output any status messages
```#### Examples
```
./wait-for-it.sh -h www.google.com -p 80 -t 5 -c "echo Google is up" -q
./wait-for-it.sh -h www.google.com -p 8080 -t 5
```#### Other
See this, too: https://github.com/jwilder/dockerize