Host / Port when running Shiny App as background job

I am trying to run a shiny app in Rstudio as a background job. Whenever I do, it ignores my host/post settings and defaults to local host / Is there another way I need to be calling my app for this to work?

...shinyApp(ui, server, options = list(port = 6087, host = ""))


If you like to run it as a background job, you have to write a separate script that calls the app with runApp. So you write the app as you normally would (don't set any options), then write another script (that you submit as the job) that calls the app with the specific host and port settings like this:


#The path is to the folder, not the app file (app should be called app.R or server.R/ui.R)
runApp("pathToShinyAppFolder/", launch.browser = T, host = "", port = 1234)

This app is hosted on your local machine, so any other IP you set apart from your own won't work I think. As noted in the documentation: To allow other clients to connect, use the value "" instead.

Hope this helps,

I still find it odd that the options work when using run app in R console, but not as a background job, but this is a functioning workaround. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.