Coder Social home page Coder Social logo

ettore26 / wait-for-command Goto Github PK

View Code? Open in Web Editor NEW
22.0 3.0 5.0 2 KB

Posix sh compliant pure shell script which waits for a specific command exit status. Works in BusyBox.

License: MIT License

Shell 100.00%
shell busybox docker posix-sh posix

wait-for-command's Issues

cmd with exit status 0 evaluated as 125

my command of interest:

docker inspect -f "{{.State.Health.Status}}" p6spy_postgresql_1 | grep -qw healthy

once running without wait-for-command.sh I see:

docker inspect -f "{{.State.Health.Status}}" p6spy_postgresql_1 | grep -qw healthy && echo $?
0

So should be all fine, but using wait-for-command.sh I see:

/tmp/wait-for-command.sh -t 1 -c 'docker inspect -f "{{.State.Health.Status}}" p6spy_postgresql_1 | grep -qw healthy'
wait-for-command.sh failed after 1 second(s).
cmd:                 docker inspect -f "{{.State.Health.Status}}" p6spy_postgresql_1 | grep -qw healthy
target exit status:  0
exited status:       125

wait-for-command tries to consume &&

Using a combination of wait-for-command.sh and another command as the command: directive in a docker-compose file with an Alpine based image yields wait-for-command trying to use && as an argument.

command: wait-for-command.sh -c 'nc -z db 3306' && $command

wait-for-command.sh tries to utilize the && and the script breaks, uncertain if this is a shell or script issue.
Sorry I don't have an exact log on hand at the moment, if necessary will reproduce.

Current workaround: (installing bash already, so using it)
command: bash -c "sh -c \"./wait-for-command.sh -t 120 -c 'nc -z db 3306'\" && $command"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.