Correctly executing system code using R in Ubuntu server

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Correctly executing system code using R in Ubuntu server

Bogaso
Hi,

I am curious on how to correctly run System code with R under Ubuntu. I
tried to execute below 2 lines of code using system() functions in Ubuntu
server, however could not achieve the desired result.

system('Xvfb :10 -ac &')
system('export DISPLAY=:10')

System parameters:
> Sys.info()
                                       sysname
                                       "Linux"
                                       release
                           "4.4.0-128-generic"
                                       version
"#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018"
                                      nodename
                  "ubuntu-s-2vcpu-4gb-blr1-01"
                                       machine
                                      "x86_64"
                                         login
                                        "root"
                                          user
                                        "root"
                                effective_user
                                        "root"

Background:
I use RSelenium package to perform various testing using web-browser. I
have installed firefox to do the same, however to make RSelenium work, it
requires display parameter as guided in below link:
https://medium.com/@griggheo/running-selenium-webdriver-tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2
I want to set those parameters through R, each time I start R in Ubuntu
server.

Appreciate for any pointer.

Thanks,

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Correctly executing system code using R in Ubuntu server

R help mailing list-2
Each call to system() starts and finishes a new shell so your approach will
not work.
Does the following do what you need?

> system('Xvfb :10 -ac &')
> Sys.setenv(DISPLAY=":10")
> x11()
Warning message:
In x11() : cairo-based types may only work correctly on TrueColor visuals



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Jun 25, 2018 at 2:04 PM, Christofer Bogaso <
[hidden email]> wrote:

> Hi,
>
> I am curious on how to correctly run System code with R under Ubuntu. I
> tried to execute below 2 lines of code using system() functions in Ubuntu
> server, however could not achieve the desired result.
>
> system('Xvfb :10 -ac &')
> system('export DISPLAY=:10')
>
> System parameters:
> > Sys.info()
>                                        sysname
>                                        "Linux"
>                                        release
>                            "4.4.0-128-generic"
>                                        version
> "#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018"
>                                       nodename
>                   "ubuntu-s-2vcpu-4gb-blr1-01"
>                                        machine
>                                       "x86_64"
>                                          login
>                                         "root"
>                                           user
>                                         "root"
>                                 effective_user
>                                         "root"
>
> Background:
> I use RSelenium package to perform various testing using web-browser. I
> have installed firefox to do the same, however to make RSelenium work, it
> requires display parameter as guided in below link:
> https://medium.com/@griggheo/running-selenium-webdriver-
> tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2
> I want to set those parameters through R, each time I start R in Ubuntu
> server.
>
> Appreciate for any pointer.
>
> Thanks,
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Correctly executing system code using R in Ubuntu server

Bogaso
It worked. Thanks,

On Tue, Jun 26, 2018 at 2:46 AM William Dunlap <[hidden email]> wrote:

> Each call to system() starts and finishes a new shell so your approach
> will not work.
> Does the following do what you need?
>
> > system('Xvfb :10 -ac &')
> > Sys.setenv(DISPLAY=":10")
> > x11()
> Warning message:
> In x11() : cairo-based types may only work correctly on TrueColor visuals
>
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Mon, Jun 25, 2018 at 2:04 PM, Christofer Bogaso <
> [hidden email]> wrote:
>
>> Hi,
>>
>> I am curious on how to correctly run System code with R under Ubuntu. I
>> tried to execute below 2 lines of code using system() functions in Ubuntu
>> server, however could not achieve the desired result.
>>
>> system('Xvfb :10 -ac &')
>> system('export DISPLAY=:10')
>>
>> System parameters:
>> > Sys.info()
>>                                        sysname
>>                                        "Linux"
>>                                        release
>>                            "4.4.0-128-generic"
>>                                        version
>> "#154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018"
>>                                       nodename
>>                   "ubuntu-s-2vcpu-4gb-blr1-01"
>>                                        machine
>>                                       "x86_64"
>>                                          login
>>                                         "root"
>>                                           user
>>                                         "root"
>>                                 effective_user
>>                                         "root"
>>
>> Background:
>> I use RSelenium package to perform various testing using web-browser. I
>> have installed firefox to do the same, however to make RSelenium work, it
>> requires display parameter as guided in below link:
>>
>> https://medium.com/@griggheo/running-selenium-webdriver-tests-using-firefox-headless-mode-on-ubuntu-d32500bb6af2
>> I want to set those parameters through R, each time I start R in Ubuntu
>> server.
>>
>> Appreciate for any pointer.
>>
>> Thanks,
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.