In a nutshell, use screen
Why?
Sometimes we are concerned that if our connection gets closed, the process we are running will close too.
The processes or login sessions you establish through screen don't go away. You can resume your screen sessions.
How?
-
run screen command
screen
or you can give that screen a name (will help afterwards)
screen -S some_name
-
run your time consuming command
script/runner path_to_some_long_script.rb
-
detatch from your screen with the following commands
Crtl + A
d
-
to reattach run
screen -r some_name
-
to exit the screen run
exit
:)
TIPS
to see all screens you can run (it will show the screen PID and name)
screen -ls
you can reattach a screen by giving it's name or it's PID
screen -r some_name
or screen -r PID
if there is only one screen, then you can use simply
screen -r
can be used for other things not only for running lengthy scripts