On Fri, 27 Aug 1999, John Aldrich wrote:

> On Fri, 27 Aug 1999, you wrote:
> > 
> >     The formant of crontab may differ from distro to distro, so you
> > would do well to do a 'man 5 crontab' on your system. The actual command
> > to specify cron settings is 'crontab -e'.
> > 
> Ok. I think I understand how to write a cron program, but today, I
> had a cron script set to play an MP3 at 0600, using xmms. However,
> instead of playing I got an answer that it couldn't open display "0:"
> which is how I was told to get it to start up an X program from a
> Cron job. :-(
>       John
> 
John,

        You have a fundamental problem in what you are trying to do.
'cron' will execute programs in 'batch' mode. This means that there is no
'tty' associated with the program - much less an X-server display. While
it is possible to set up the environment variable DISPLAY to point to an
existing X-server display, I dont have a clue as to what will happen. Even
if this would work, you would have to guarantee to your cron program that
whenever the job runs, the DISPLAY variable would point to an existing X
screeen.

        Lets say you are expecting the program to display on the same host
as it is being executed on. In that case, the DISPLAY environment variable
can be set to ':n' where 'n' the display number and ranges from 0 to 'm -
1' where you have 'm' X sessions started up. If your X authority set up is
based on Xlib (I believe Redhat uses xhost - so you shouldnt have to
worry about this), then you may have some problems in giving your program
the authority to display on the display that you select (read the manpage
for 'xauth'). 

        I hope I have explained this clearly. Let me know if you still
have questions.

Regards,
Kenneth

Reply via email to