How to start/stop/flush OpenCPU on CentOS6?

两盒软妹~` 提交于 2019-12-07 12:37:12

问题


I've successfully built and installed OpenCPU and RStudio Server on a CentOS6. Everything is working as expected, and I do get successful GET/POST responses for my local R packages.

A couple of things that don't seem to work however:

  • I can't figure a clean way to start/stop/flush OpenCPU. I'm currently using apachectl restart but I'm not even sure that does reload R packages as expected. I tried Jeroen's bash scripts at /usr/lib/opencpu/scripts but they seem to require quite a bit of tweaking to work on CentOS.
  • (maybe related to above) I am using load() and readRDS() in /etc/opencpu/Renviron file (also tried in /etc/opencpu/Rprofile) to load persistent datasets into the global environment -- but that doesn't seem to work. I don't get any error log, but the objects are not available in subsequent requests.
  • on Ubuntu OpenCPU seems configured to run under an opencpu user. On CentOS6 it seems to run under root after installation. I'd like to modify that, but not sure how.

Just wondering if someone has has success configuring OpenCPU on CentOS6.

Many thanks, --Mel.


回答1:


Some answers

  • Running sudo apachectl restart will do the restart. There is currently no special init or systemd script for opencpu included with the rpm, but basically all that script does on ubuntu is restart apache and print some messages to the terminal.

  • The REnviron file is only for environment variables. You need to use RProfile for custom code. See also help. Maybe it doesn't get loaded in the right environment. Try: load(file, envir = globalenv(), verbose = TRUE).

  • Note that the recommended way to store stuff is by putting it an R package, either as lazyload data or sysdata.rda (see writing R extensions). You can then load or attach the package on startup, or better yet: formally import the dataset from the package that contains your application or R functions.

  • Afaik, centos runs httpd requests as user apache? What makes you think opencpu runs as root? That is certainly not the intention. On CentOS you sometimes need to play around with SELinux httpd flags to get your applications to work, see also the rpm readme.

The rpm packages are a bit more recent and less tested than the debian ones, so if you have problems or suggestions, please open an issue on github.



来源:https://stackoverflow.com/questions/26706178/how-to-start-stop-flush-opencpu-on-centos6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!