Re: X program from cron
On Thu, Jan 15, 2004 at 10:24:30PM +0000, Antony Gelberg wrote:
> Hi all,
>
> I want to update my wallpaper at time intervals. So, I've set up a
> crontab:
> # DO NOT EDIT THIS FILE - edit the master and reinstall.
> # (/tmp/crontab.bCmoxk/crontab installed on Thu Jan 15 21:07:39 2004)
> # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp
> # $)
> 0 * * * * $HOME/bin/wallpaper_rotate $HOME/pics/wallpaper/
>
> wallpaper_rotate is a dirty shell script:
> #!/bin/sh
> NEXTFILE=`ls $1 | rl -c 1`
> wmsetbg $1$NEXTFILE
>
> Now that's coding. Anyway, it works. However, cron reports:
> wmsetbg fatal error: could not open display
>
> I guess this is because it is not being run from my X session. Question
> is, is there anything I can do to get it to work the way that I want?
>
Set DISPLAY at the top of your crontab. This is probably not "The Right
Way" though. `wmsetbg' is asking to use your X server's display (for
whatever reasons it may have) but cron knows nothing about your
display(s). A better solution would be to find another way to change the
background (that doesn't need to access the display.)
Reply to: