Cron/Xwindows

Tony Hammitt tony at speedscript.com
Wed Oct 22 16:02:03 CDT 2003


Jonathan Hutchins wrote:
> 
> On Wednesday 22 October 2003 09:01 am, Tony Hammitt wrote:
> 
> > You may have to add this to your cron entry:
> 
> > 0 12 * * * DISPLAY=localhost:0 xwindowsprogram
> 
> > or something like that, because it sounds like your program doesn't know
> > which display to contact.
> 
> Ok, so "DISPLAY=localhost:0" preceeds the program call.
> 
> > it can't make assumptions, since it would run
> > the same xhosted to Timbuktu as on your local computer, albeit slower :)
> 
> Sure it can.  It can check for the existance of locally running XWindows
> sessions; can check to see if the call is remote.  It would be a very
> reasonable assumption that the display should be the local default display
> unless a remote display is specified.
> 
> Realistically, how many Linux systems actually run multiple display sessions?
> I know the capacitiy is there, and I know that it's used in some
> environments, but the majority of Linux installations are single user, single
> display systems.
> 

I ended up making a shell script that runs export DISPLAY=localhost:0 then
runs the program, it works fine that way.  Here's my script and crontab entry:

$ crontab -l
* * * * * $HOME/bin/xclock

$ cat $HOME/bin/xclock
#!/bin/bash

export DISPLAY=localhost:0

/usr/bin/X11/xclock &

exit 0

Man, this clock thing is annoying.... :)

Regards,

	Tony




More information about the Kclug mailing list