Mailing List Archive

Newbie question: vncserver running on port :25, need to attach Perl script to this when it executes
Hi there VNC gurus,

I have what I think is a pretty standard question, but I cannot seem
to figure it out in the usual way (man pages, web search, etc).

I have a vnc server that I have got running on port localhost:25 via
the command:

vncserver.rt :25 -name "My Display" -geometry 1024x1000 -localhost

This works well, and I can connect to it via the command:

vncviewer localhost:25

(I get prompted for a password, which I enter, after setting it up
earlier using vncpasswd)

So I have a fully fledged working desktop on localhost:25. Now to what
I really want to do....

I have a Perl script that I normally run from the X11 command line.
This outputs much information, then opens up three Ghostscript
windows, creates some postscript image files, then converts them to
pdf files using the Ghostscript command ps2pdf.

I need this script to run via cron without me being logged in, hence
why I thought Xvnc would be solution. However, I cannot seem to figure
out how to force my script to attach to this port and run successfully.

One solution I tried was to force the display port before running the
script, by creating a wrapper script such as:

hostname{user}1% cat mywrapper.sh
#!/bin/sh

DISPLAY=localhost:25.0
export DISPLAY

/path/to/myperlscript.pl -args

DISPLAY=localhost:0.0
export DISPLAY

This forces the script to execute on (what I think is) the correct
display. However, my script fails with a bunch of Ghostscript errors.

(Note that I cannot force the script to run on a different display by
adding the -display option to my Perl script - it does not recognize
that argument)

Does anyone have advice for a newbie? I am stuck.

Thanks in advance.

- Rob

_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list
RE: Newbie question: vncserver running on port :25, need to attach Perl script to this when it executes [ In reply to ]
-----Original Message-----
From: vnc-list-bounces@realvnc.com [mailto:vnc-list-bounces@realvnc.co
m] On Behalf Of Rob Newman
Sent: Monday, November 30, 2009 3:13 PM
To: vnc-list@realvnc.com
Subject: Newbie question: vncserver running on port :25,need to attach
Perl script to this when it executes

> Hi there VNC gurus,

[snip]

> So I have a fully fledged working desktop on localhost:25. Now to what

> I really want to do....
>
> I have a Perl script that I normally run from the X11 command line.
> This outputs much information, then opens up three Ghostscript
> windows, creates some postscript image files, then converts them to
> pdf files using the Ghostscript command ps2pdf.
>
> I need this script to run via cron without me being logged in, hence
> why I thought Xvnc would be solution. However, I cannot seem to figure


[snip]

> Does anyone have advice for a newbie? I am stuck.
>
> Thanks in advance.
>
> - Rob



Rob:

Why not just copy the file to the system from which U're running
vncviewer and run your perl script and gs there? The data being
exchanged between the viewer and the server is RFB protocol, not
PostScript or PDF ... unless U *want* to perl the RFB data, of
course.

Thx, Phil Long

--------------------------------------------------------

Goss ... Innovation for Business

NOTICE: This e-mail and any attachment(s) may contain confidential and proprietary information of Goss International Corporation and/or its subsidiaries and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender. No contract may be construed by this e-mail.


_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list
Re: Newbie question: vncserver running on port :25, need to attach Perl script to this when it executes [ In reply to ]
Hi Phil,

Thanks so much for the reply, however I think I didn't explain my
problem clearly. The script is already on the same server, I just need
the Perl script to attach to a display port (localhost:25 in this
case) when it is run nightly via cron, as the script creates images
that need an X window to process in. The point of me showing I can
successfully attach to the port via vncviewer was purely to
demonstrate that I have everything related to VNC working in a stable
environment.

After trawling the VNC mailing list archives all day yesterday I saw a
couple of threads about Xvfb - which might be all I need. However, I
cannot pass my Perl script a display argument, so I need to somehow
force the script to use the localhost:25 port. Hence why I had been
attempting to export the DISPLAY variable in my wrapper script
(attached again below).



hostname{user}1% cat mywrapper.sh
#!/bin/sh

DISPLAY=localhost:25.0
export DISPLAY

/path/to/myperlscript.pl -args

DISPLAY=localhost:0.0
export DISPLAY



However, it is still not working.

Best regards,
- Rob

> Rob:
>
> Why not just copy the file to the system from which U're running
> vncviewer and run your perl script and gs there? The data being
> exchanged between the viewer and the server is RFB protocol, not
> PostScript or PDF ... unless U *want* to perl the RFB data, of
> course.
>
> Thx, Phil Long

_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list
Re: Newbie question: vncserver running on port :25, need to attach Perl script to this when it executes [ In reply to ]
>>>>> "Rob" == Rob Newman <rlnewman@ucsd.edu> writes:

Rob> I have a vnc server that I have got running on port
Rob> localhost:25 via the command:

Rob> vncserver.rt :25 -name "My Display" -geometry 1024x1000
Rob> -localhost

<snip>

Rob> I have a Perl script that I normally run from the X11 command
Rob> line. This outputs much information, then opens up three
Rob> Ghostscript windows, creates some postscript image files,
Rob> then converts them to pdf files using the Ghostscript command
Rob> ps2pdf.

Rob> I need this script to run via cron without me being logged
Rob> in, hence why I thought Xvnc would be solution. However, I
Rob> cannot seem to figure out how to force my script to attach to
Rob> this port and run successfully.

First things first, are you running as the same user from cron ? If so
you could add "xauth list" to the script (after export DISPLAY) to see
what displays the script has access to.

Sincerely,

Adrian Phillips

--
Who really wrote the works of William Shakespeare ?
http://www.pbs.org/wgbh/pages/frontline/shakespeare/

_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list
RE: Newbie question: vncserver running on port :25, need to attach Perl script to this when it executes [ In reply to ]
-----Original Message-----
From: vnc-list-bounces@realvnc.com [mailto:vnc-list-bounces@realvnc.com]
On Behalf Of Rob Newman
Sent: Tuesday, December 01, 2009 12:24 PM
To: vnc-list@realvnc.com
Subject: Re: Newbie question: vncserver running on port :25,need to
attach Perl script to this when it executes

> Hi Phil,
>
> Thanks so much for the reply, however I think I didn't explain my
> problem clearly. The script is already on the same server, I just need

> the Perl script to attach to a display port (localhost:25 in this
> case) when it is run nightly via cron, as the script creates images
> that need an X window to process in. The point of me showing I can
> successfully attach to the port via vncviewer was purely to
> demonstrate that I have everything related to VNC working in a stable

> environment.
>
> After trawling the VNC mailing list archives all day yesterday I saw a

> couple of threads about Xvfb - which might be all I need. However, I
> cannot pass my Perl script a display argument, so I need to somehow
> force the script to use the localhost:25 port. Hence why I had been
> attempting to export the DISPLAY variable in my wrapper script

[snip]



Rob:

Well, it's more likely that I didn't read your initial post
correctly; when I'm at work, I'm always in a rush. :-/

I can't say that I have a VNC solution for U, but if U're only
using ps2pdf, U shouldn't need to use an X server. In fact,
if gs is being used to generate PostScript output to feed to
gs, U should be able to use '-dBATCH' on the gs command line
to inhibit output (that's what psp2pdf does).

BTW, thanx for the tip about Xvfb; that looks handy!

Thx, Phil Long

--------------------------------------------------------

Goss ... Innovation for Business

NOTICE: This e-mail and any attachment(s) may contain confidential and proprietary information of Goss International Corporation and/or its subsidiaries and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender. No contract may be construed by this e-mail.


_______________________________________________
VNC-List mailing list
VNC-List@realvnc.com
To remove yourself from the list visit:
http://www.realvnc.com/mailman/listinfo/vnc-list