Managing the Server
RStudio server management tasks are performed using the rstudio-server utility (installed under /usr/sbin in binary distributions). This utility enables the stopping, starting, and restarting of the server, enumeration and suspension of user sessions, taking the server offline, as well as the ability to hot upgrade a running version of the server.
Stopping and Starting
If you installed RStudio using a package manager binary (e.g. a Debian package or RPM) then RStudio is automatically registred as a deamon which starts along with the rest of the system. On Ubuntu this registration is performed using an Upstart script at /etc/init/rstudio-server.conf. On other systems an init.d script is installed at /etc/init.d/rstudio-server.
To manually stop, start, and restart the server you use the following commands:
$ sudo rstudio-server stop $ sudo rstudio-server start $ sudo rstudio-server restart
Managing Active Sessions
There are a number of administrative commands which allow you to see what sessions are active and request suspension of running sessions (note that session data is not lost during a suspend).
To list all currently active sessions:
$ sudo rstudio-server active-sessions
To suspend an individual session:
$ sudo rstudio-server suspend-session <pid>
To suspend all running sessions:
$ sudo rstudio-server suspend-all
The suspend commands also have a "force" variation which will send an interrupt to to the session to request the termination of any running R command:
$ sudo rstudio-server force-suspend-session <pid> $ sudo rstudio-server force-suspend-all
The force-suspend-all command should be issued immediately prior to any reboot so as to preserve the data and state of active R sessions accross the restart.
Taking the Server Offline
If you need to perform system maintenance and want users to receive a friendly message indicating the server is offline you can issue the following command:
$ sudo rstudio-server offline
When the server is once again available you should issue this command:
$ sudo rstudio-server online
Upgrading to a New Version
If you perform an upgrade of RStudio Server using a package manager binary (e.g. a Debian package or RPM) and a version of RStudio Server is currently running, then the upgrade process will also ensure that active sessions are immediately migrated to the new version. This includes the following behavior:
- Running R sessions are suspended so that future interactions with the server automatically launch the updated R session binary
- Currently connected browser clients are notified that a new version is available and automatically refresh themselves.
- The core server binary is restarted