4

I am running RStudio server on an ec2 instance (using Louis Aslett's AMI) and connect through the browser.

I have some long scripts to run and thought I would be able to leave them running and close the browser tab/turn off my computer.

However, when I do this it seems to interrupt the console and when I log back into the server (pasting address into address bar and logging back in) I am met with an alert telling me that the R session terminated and my workspace is completely reset (working directory reset, and any data or variables lost).

Note that I am not terminating the instance, I am simply closing the browser tab that RStudio is loaded in.

Am I doing something wrong? Is there a proper way to disconnect safely and prevent this from happening?

Thanks

0mm3
  • 319
  • 2
  • 16

1 Answers1

2

The author of the AMI implies that the AMI is based on Linux, so you can run screen before launching your RStudio server session.

The screen package is bundled with most Linux distributions. The author doesn't mention which distro his AMI is based on or list all of the included packages, but if the AMI doesn't have it, then you can use a package manger to install it:

sudo apt-get install screen -y

if your package manager is apt. The installation using the yum package manager is similar.

Hack-R
  • 22,422
  • 14
  • 75
  • 131
  • @0mm3 can you post exactly what you did to get this to work? I'm using one of those AMIs as well, and I have rstudio server running in screen at Hack-R suggested. I login in, start one of the long scripts, but I get a "terminate R/keep waiting" dialogue box when I try to log back in later. – Libby Feb 17 '17 at 23:04
  • 2
    @Libby Hi, what I do is ssh into the ec2 instance using the following commands on Mac OS: `chmod 400 PEMFILE.pem` `ssh -i PEMFILE.pem ubuntu@c2-00-000-000-000.eu-west-1.compute.amazonaws.com` Substitute in your .pem file name for PEMFILE and also your own ec2 instance address (which can be seen in the aws GUI online under the instance details). Once this is done, i just type `screen` in the terminal and it's all set. Hope this helps – 0mm3 Feb 19 '17 at 09:32