Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to execute command with args after the test finishes #3

Closed
CyberMew opened this issue Mar 5, 2018 · 5 comments
Closed

How to execute command with args after the test finishes #3

CyberMew opened this issue Mar 5, 2018 · 5 comments

Comments

@CyberMew
Copy link

CyberMew commented Mar 5, 2018

So I'm waiting for my mongo db to startup at dbip:dbport, and once done I need it to run a command to start my server. I was thinking of something like ./wtfc.sh dbip:port runmyserverscript argstomyscripthere Is this possible with this script or am I mistaken?

@typekpb
Copy link
Owner

typekpb commented Mar 5, 2018

@CyberMew well, I'd run it like this:

./wtfc.sh -T 0 nc -z <dbip> <dbport>
<runmyserverscript> <argstomyscripthere>

So it should wait for the your mongo to be up first (without timeout), once it's up, it'll run whatever you need.

@CyberMew
Copy link
Author

TestingOnMyMacTerminal:test CyberMew$ ./wtfc.sh -T 0 nc -z localhost 27017 echo "aa"
wtfc.sh: waiting without a timeout for nc -z localhost 27017 echo aa

Starting up an instance of mongodb..

wtfc.sh: nc -z localhost 27017 echo aa finished with expected status 0 after 10 seconds

I got the above output following your instructions, but echo wasn't executed.

@typekpb
Copy link
Owner

typekpb commented Mar 14, 2018

the problem is, that it are the 2 separate commands, the 1.st one is the ./wtfc... and the echo "aa" is the 2.nd only only. So you should not try to run them together (as one command)

@CyberMew
Copy link
Author

Ah I see.. so there is no way for this to wait for a service to be ready and then get it do something?

@typekpb
Copy link
Owner

typekpb commented Apr 23, 2018

@CyberMew unless you run the 1.st command in the background, it's an implicit way of running things in the shell => in sequence

Closing, as solution seems to be clarified. Feel free to reopen if more discussion is needed.

@typekpb typekpb closed this as completed Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants