1

I am currently logged into a remove server using a particular user account. I kicked off a really long script, and have no idea when it will finish. It is blocking me from using the terminal that I connected to the server with.

What will happen if I open a second terminal, and connect with the same user account to the same server ? Will it log off my connection from the other terminal, and interrupt / kill the other running script ?

I am using ubuntu 12.04 LTS

3

You can have multiple connections without a problem. Each connection will have its own shell.

In the future you may want to start the script with nohup and background the script. This will allow the script to continue to run, even if you loose your shell. Also you can continue to use your existing shell without needing to open a new connection

nohup ./foo.sh &
2

No, it won't log you off. Linux (and pretty much any UNIX-like OS) is a multi-user, multi-session environment, so in your example,you'll have two independent user sessions.

0

Another option, if it is available, is to use the screen command. Screen is a terminal multiplexer that allows you to disconnect from a long term running process and later reconnect to the same session so you can check its status and/or take other actions.

screen is a feature rich program and can take some practice to master. I'd recommend you read the man page on it to get a better understanding.

Here are a few examples to get you started:

  1. To start a program an immediately disconnect, run: screen -d -m /path/to/program
  2. To "list" your multiple screen sessions, run: screen -ls
  3. To "reconnect" to a session, if there is only run running, run: screen -r
  4. If you have multiple screen sessions running, first run screen -ls, then to connect to a specific question (observing the session name) you can reconnect using something like: screen -r 1234.tty1.hostname (the 1234.tty1.hostname is just an example of what might be printed as the output from screen -ls).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.