Utility that can be configured to run two commands, and kill both when one finishes
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Is there a common utility (Ubuntu, perhaps OSX) that can run a server serve ./public
, then run some tests ./run-chrome-tests.sh
, and once the tests are finished, kills the serve ./public
.
This can be done in bash, but I'd rather create configuration, than code if it is feasible.
process-management
add a comment |Â
up vote
0
down vote
favorite
Is there a common utility (Ubuntu, perhaps OSX) that can run a server serve ./public
, then run some tests ./run-chrome-tests.sh
, and once the tests are finished, kills the serve ./public
.
This can be done in bash, but I'd rather create configuration, than code if it is feasible.
process-management
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Is there a common utility (Ubuntu, perhaps OSX) that can run a server serve ./public
, then run some tests ./run-chrome-tests.sh
, and once the tests are finished, kills the serve ./public
.
This can be done in bash, but I'd rather create configuration, than code if it is feasible.
process-management
Is there a common utility (Ubuntu, perhaps OSX) that can run a server serve ./public
, then run some tests ./run-chrome-tests.sh
, and once the tests are finished, kills the serve ./public
.
This can be done in bash, but I'd rather create configuration, than code if it is feasible.
process-management
asked Feb 8 at 10:20
Ashley Coolman
1063
1063
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
add a comment |Â
up vote
2
down vote
accepted
There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.
There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.
answered Feb 8 at 10:44
Kusalananda
103k13202318
103k13202318
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
add a comment |Â
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
Ah, that is even simpler than the bash I had envisioned...very nice. Accepted because this is what I'll end up doing even though it wasn't exactly what i asked for.
â Ashley Coolman
Feb 8 at 11:25
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f422763%2futility-that-can-be-configured-to-run-two-commands-and-kill-both-when-one-finis%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password