Skip to content

Instantly share code, notes, and snippets.

@cbilgili
Created July 27, 2017 17:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbilgili/1d6b9b1538996c7813e869c7ffc97b4b to your computer and use it in GitHub Desktop.
Save cbilgili/1d6b9b1538996c7813e869c7ffc97b4b to your computer and use it in GitHub Desktop.
How to keep rails command from Rails Console running after SSH Client (PuTTy) closes
Use sudo apt-get install screen to install screen. Then run it using screen. Now you have a separate console window which can be detached using Ctrl + A, then D. Closing putty will not end your screen-session. If you log back in at any later point, you may resume the sessions using screen -r.
To summarize:
> sudo apt-get install screen
> screen
# pops up a new shell
> rails c
# run your reindex operation
# press Ctrl + A, then D
> exit
# putty closes
# reconnect using putty
> screen -r
# you should be back in your rails console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment