Utility that can be configured to run two commands, and kill both when one finishes

The name of the pictureThe name of the pictureThe name of the pictureClash 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.







share|improve this question
























    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.







    share|improve this question






















      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.







      share|improve this question












      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.









      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 8 at 10:20









      Ashley Coolman

      1063




      1063




















          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.






          share|improve this answer




















          • 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











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          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






























          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.






          share|improve this answer




















          • 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















          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.






          share|improve this answer




















          • 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













          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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

















          • 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













           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?