Leave bash script running on remote terminal while not logged in?












13















I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).



I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs. Does anyone know what this command is?



Thanks










share|improve this question





























    13















    I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).



    I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs. Does anyone know what this command is?



    Thanks










    share|improve this question



























      13












      13








      13


      5






      I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).



      I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs. Does anyone know what this command is?



      Thanks










      share|improve this question
















      I have a bash script that takes several hours to run. While it's running, I would like to do other things, which may involve logging out or disconnecting from the internet (my script runs network tests on various computers).



      I understand that there is a command that would allow me to run my tests from a remote terminal and logout of the terminal while it runs. Does anyone know what this command is?



      Thanks







      bash ssh remote-desktop process






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 11 '10 at 2:03









      quack quixote

      35.3k1087119




      35.3k1087119










      asked Feb 21 '10 at 17:07









      Ritwik BoseRitwik Bose

      5535930




      5535930






















          1 Answer
          1






          active

          oldest

          votes


















          15














          The command you are looking for is nohup.



          There is also screen, which is for when you want to leave something running but come back and reattach interactively later.



          nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.






          share|improve this answer


























          • I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

            – Ritwik Bose
            Feb 21 '10 at 17:18






          • 1





            nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

            – Justin Smith
            Feb 21 '10 at 17:22











          • Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

            – Ritwik Bose
            Feb 21 '10 at 17:23











          • Good answer. You should add the screen comment to you answer so that it stands out more.

            – DaveParillo
            Feb 21 '10 at 22:13











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f111631%2fleave-bash-script-running-on-remote-terminal-while-not-logged-in%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          15














          The command you are looking for is nohup.



          There is also screen, which is for when you want to leave something running but come back and reattach interactively later.



          nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.






          share|improve this answer


























          • I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

            – Ritwik Bose
            Feb 21 '10 at 17:18






          • 1





            nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

            – Justin Smith
            Feb 21 '10 at 17:22











          • Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

            – Ritwik Bose
            Feb 21 '10 at 17:23











          • Good answer. You should add the screen comment to you answer so that it stands out more.

            – DaveParillo
            Feb 21 '10 at 22:13
















          15














          The command you are looking for is nohup.



          There is also screen, which is for when you want to leave something running but come back and reattach interactively later.



          nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.






          share|improve this answer


























          • I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

            – Ritwik Bose
            Feb 21 '10 at 17:18






          • 1





            nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

            – Justin Smith
            Feb 21 '10 at 17:22











          • Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

            – Ritwik Bose
            Feb 21 '10 at 17:23











          • Good answer. You should add the screen comment to you answer so that it stands out more.

            – DaveParillo
            Feb 21 '10 at 22:13














          15












          15








          15







          The command you are looking for is nohup.



          There is also screen, which is for when you want to leave something running but come back and reattach interactively later.



          nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.






          share|improve this answer















          The command you are looking for is nohup.



          There is also screen, which is for when you want to leave something running but come back and reattach interactively later.



          nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 21 '10 at 22:38

























          answered Feb 21 '10 at 17:11









          Justin SmithJustin Smith

          3,4711716




          3,4711716













          • I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

            – Ritwik Bose
            Feb 21 '10 at 17:18






          • 1





            nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

            – Justin Smith
            Feb 21 '10 at 17:22











          • Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

            – Ritwik Bose
            Feb 21 '10 at 17:23











          • Good answer. You should add the screen comment to you answer so that it stands out more.

            – DaveParillo
            Feb 21 '10 at 22:13



















          • I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

            – Ritwik Bose
            Feb 21 '10 at 17:18






          • 1





            nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

            – Justin Smith
            Feb 21 '10 at 17:22











          • Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

            – Ritwik Bose
            Feb 21 '10 at 17:23











          • Good answer. You should add the screen comment to you answer so that it stands out more.

            – DaveParillo
            Feb 21 '10 at 22:13

















          I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

          – Ritwik Bose
          Feb 21 '10 at 17:18





          I looked at nohup right now and apparently there are issues with input and output which might cause the script to hang up. I also saw something about screen, which strikes me as what I had read about before. Do you know how to use either of these?

          – Ritwik Bose
          Feb 21 '10 at 17:18




          1




          1





          nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

          – Justin Smith
          Feb 21 '10 at 17:22





          nohup is for when a script expects no user input - it saves all output to a file. Screen is for when you want to leave something running but come back and reattach interactively later. nohup is simpler if a command expects no user input after launch, and screen is better if you want to be ably to run the program interactively.

          – Justin Smith
          Feb 21 '10 at 17:22













          Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

          – Ritwik Bose
          Feb 21 '10 at 17:23





          Ah found it. For screen, it's ctrl-A d to detach and -r +pid to reattach.

          – Ritwik Bose
          Feb 21 '10 at 17:23













          Good answer. You should add the screen comment to you answer so that it stands out more.

          – DaveParillo
          Feb 21 '10 at 22:13





          Good answer. You should add the screen comment to you answer so that it stands out more.

          – DaveParillo
          Feb 21 '10 at 22:13


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f111631%2fleave-bash-script-running-on-remote-terminal-while-not-logged-in%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido