Sessions Startup Scripts
When an RStudio Pro Session starts up, the following scripts are run:
- Workbench: Any PAM session modules
- Workbench: The
/etc/rstudio/rsession-profile
script - Workbench: The environment module for the R version in use, if any; see Extended R version definitions
- Workbench: The prelaunch script for the R version in use, if any; see Extended R version definitions
- Workbench: System and user shell profile scripts, such as
.bash_profile
- Workbench: The R process itself, inside any supervisor specified by
rsession-exec-command
.Rprofile
and other R initialization scripts; see Initialization at the Start of a Session for details- RStudio Pro-internal session startup scripts
- The
rstudio.sessionInit
hook
The very last of these provides a way to run code after the R Session is fully booted and ready to use; since the RStudio Pro-internal session startup scripts only run in RStudio Pro it can be used to finalize R Sessions in RStudio Pro-specific ways, using for example methods in the rstudioapi
package. Here is an example that prints the RStudio Pro version in new RStudio Pro Sessions:
# /opt/R/version/lib64/r/etc/Rprofile.site
setHook("rstudio.sessionInit", function(newSession) {
if (newSession)
message("Welcome to RStudio ", rstudioapi::getVersion())
action = "append") },