[CentOS] how to run a command on a specific vnc display

Thu Dec 9 10:11:47 UTC 2010
Robert Grasso <robert.grasso+nv at cedrat.com>

Hello,

ssh sets the DISPLAY variable itself provided that :

- the X11 forwarding is enabled in the remote sshd server :

in /etc/ssh/sshd_config : you must have : X11Forwarding yes

(man sshd_config)

- you start the ssh connection with option -X, or you enable the X11 forwarding in your local /etc/ssh/ssh_config or in your
personal $HOME/.ssh/config setting the option : ForwardX11 yes

(man ssh_config)

Besides, the display syntax is : 

:displaynumber

(man Xserver)

Regards
---
Robert GRASSO – System engineer

CEDRAT S.A.
15 Chemin de Malacher - Inovallée - 38246 MEYLAN cedex - FRANCE 
Phone: +33 (0)4 76 90 50 45 - Fax: +33 (0)4 56 38 08 30
mailto:robert.grasso at cedrat.com - http://www.cedrat.com  

> -----Message d'origine-----
> De : centos-bounces at centos.org 
> [mailto:centos-bounces at centos.org] De la part de Roland RoLaNd
> Envoyé : 9 décembre 2010 10:27
> À : CentOS mailing list
> Objet : [CentOS] how to run a command on a specific vnc display
> 
> Hello,
> 
> I'm using selenium rc for automated testing on a centos box.
> 
> working on the box itself has no problem as long as i start 
> the server through terminal.
> 
> though if i wanted to run tests remotely i have a problem 
> with firefox not knowing on  which display to run.
> 
> i have a vnc client running on port 1 (5801/5901)
> 
> I've tried the following:
> 
> export DISPLAY=1 ; java -jar selenium-server.jar > 
> /opt/selenium/Logs/logs.txt # through ssh session though that 
> didn't work
> 
> 
> the only way to initiate it properly is to connect through 
> vnc, open a terminal and type : java -jar $PWD/selenium-server.jar
> though i don't know how to automate this.
> 
> so i thought of setting this in xstartup # vnc's startup for display 1
> 
> as such:
> 
> 
>   1 #!/bin/sh
>   2 
>   3 # Uncomment the following two lines for normal desktop:
>   4  unset SESSION_MANAGER
>   5  exec /etc/X11/xinit/xinitrc
>   6 while true ;do sh /opt/scripts/rc; done &
>   7 [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
>   8 [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
>   9 xsetroot -solid grey
>  10 vncconfig -iconic &
>  11 xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
>  12 twm &
> 
> ]# more /opt/scripts/rc
> java -jar /opt/selenium/selenium-server.jar > 
> /opt/selenium/Logs/logs.txt
> 
> 
> Though that isn't working either, and still the firefox 
> profile doesnt know where to start.
> 
> this is the error :
> 
> 
> PHPUnit_Framework_Exception: Response from Selenium RC server 
> for getNewBrowserSession(*firefox, http://www.test.com).
> Failed to start new browser session: Error while launching browser.
> 
> 
> any help to automate the startup on display 1 would be 
> greatly appreciated
> 
> 
>