[PLUG] Running Browser From Cron?

Kenneth G. Stephens kens at cad2cam.com
Sat Sep 3 20:27:11 UTC 2005


On Sat, 2005-09-03 at 12:46 -0700, Carlos Konstanski wrote:
> Xvfb might be the answer.  We use it to run our megabloated tomcat app
> on remote machines.  The app requires X resources for some reason.
> 
> The poor man's way for us to run the app on a remote machine is to run
> it in a vnc session.  This allows the ability to disconnect from the
> server without it being the wiser, since the X session remains alive and
> well.  While our app can be started and run in an ssh shell, it cannot
> be backgrounded, and the screen session in which we get the ssh shell to
> the server cannot be detached, without the server dying.  I'm no expert
> on this stuff (I'm not a sysadmin, I'm a code drone), but I do know we
> solve the problem with Xvfb.  It looks like another way to keep an X
> display session alive so an X-dependent app can have have an environment
> to run in.
> 
> Since our servers do not run any X session other then the Xvfb one, the
> sysadmins are at liberty to hardcode :0 into their scripts.  This does
> not work on a workstation, where the user is likely to be running :0
> already, and possibly others in the form of multiple graphical X
> sessions and vnc sessions.  You need some dynamic way to find the next
> available display.  If I find out how, I'll add a posting later.  I
> think our scripts were actually fixed to remove the hardcodings.  I can
> take a look.
> 
> Carlos
> 
> On Fri, 2 Sep 2005, Robert McIntosh wrote:
> 
> > Date: Fri, 02 Sep 2005 17:39:32 -0700
> > From: Robert McIntosh <mcintoshrt at gmail.com>
> > Reply-To: "General Linux/UNIX discussion and help; civil and on-topic"
> >     <plug at lists.pdxlinux.org>
> > To: plug at lists.pdxlinux.org
> > Subject: [PLUG] Running Browser From Cron?
> > 
> > I'm trying to get a cron job to load a browser page as a user multiple
> > times and then close.  Those of you with devious minds see what I'm
> > getting at.
> >
> > I would use lynx or wget, but I need a browser with javascript to load
> > the page.  Odd request, I know.
> >
> > I'm working with:
> >
> > #!/bin/sh
> > /usr/X11R6/bin/mozilla --display :0 http://www.somewebsite.com
> > exit
> >
> > and cron whines at me:
> >
> > (mozilla-bin:2725): Gtk-WARNING **: cannot open display: :0
> >
> > Please provide hints or blatant help.
> >
> > Thanks!
> > Robert
> >
> > -- 
> > Robert McIntosh
> > mcintoshrt at Comcast.net

Since you are not logging into the system from a terminal, you do not
have permission to display on :0.  You will need to allow localhost to
use the display.  Use the xhost +localhost command to provide that
permission on the session the "owns" the display.

Ken Stephens
CAD 2 CAM




More information about the PLUG mailing list