The most straightforward method to have your scripts continue after you close out of a shell session is to use a terminal multiplexer program. A terminal multiplexer will allow you to run multiple shell sessions concurrently without being actively connected to each one, even after you disconnect (detach) from them. The 2 most popular ones are screen
and tmux
.
I personally use screen
and it works extremely well for me. You start a screen
session, start your program/script, disconnect(detach), then reconnect to the detached session later on to see how things went.
To install:
sudo apt-get install screen
To start a session:
screen
To disconnect (detach) from the session:
Ctrl+A then d
To list running sessions:
screen -ls
To reconnect to a detached session, use the output from screen -ls
screen -r [pid.tty.host]
These are just the basics to get you going, but like always, man screen
has much more info
screen
is awesome; tmux may be more useful, as it's more customizable. – ILMostro_7 Jun 17 '14 at 07:26byobu
is not a “third” choice, it's more like a wrapper; it needs eitherscreen
ortmux
to run (it was originally based onscreen
) and extends display and features. – Qeole Jun 17 '14 at 11:42