You are not logged in.
I use feh to set the desktop background and cron to change it every hour. The following command
DISPLAY=:0.0 feh --bg-scale /home/tri/.wallpaper
used to work, but recently stop working. The cron log show the following error "feh ERROR: Can't open X display. It *is* running, yeah?" X is running and "echo $DISPLAY" shows ":0" I'm wondering if anyone is experiencing this issue.
Last edited by tri1976 (2011-04-29 20:24:18)
Offline
Why use a cron job?
I just execute this script:
wallpaper.sh
#!/bin/bash
shopt -s nullglob
cd ~/.wallpaper
while true; do
files=()
for i in *.jpg *.png; do
[[ -f $i ]] && files+=("$i")
done
range=${#files[@]}
((range)) && feh --bg-fill "${files[RANDOM % range]}"
sleep 15m
done
xinitrc:
. ~/.wallpaper/wallpaper.sh &
.wallpaper is my wallpaper directory. Just replace that with whatever directory you are using for your wallpaper and it should work.
Last edited by the sad clown (2011-04-10 21:11:24)
I laugh, yet the joke is on me
Offline
running a script in the background is an alternative, but I'd still like to find out why it no longer works. Since cron is already running in the background for other things, I thought it would be more efficient to use it.
Offline
Sorry, can't help you with that.
I laugh, yet the joke is on me
Offline
I don't really know too much but is there a difference between :0 and :0.0?
Offline
Have you tried issuing the command from shell and see if it has the same error?
I laugh, yet the joke is on me
Offline
I tried both already but none of them work
Offline
So, the command doesn't work in shell?
I laugh, yet the joke is on me
Offline
it does work in shell.
Offline
It might be a bug with giblib/feh and cron. giblib was recently updated (4/6) and feh about a month before that. "DISPLAY=:0" ought to have set the environment for feh, but is apparently not being recognized by feh or else somehow superceded by cron which operates at a lower level than X.
I laugh, yet the joke is on me
Offline
@the sad clown, thanks for the insight. I wonder if developers are aware of this. Perhaps, I should file a bug on the issue
Offline
I try "DISPLAY=:0 xsetroot" as a cron job and it works...the root window becomes black. So the problem appears to be with feh.
Offline
Congratulations on the fix. How did you figure it out?
I laugh, yet the joke is on me
Offline
It's not fixed yet. I just confirm that the problem is with feh not cron.
Offline
[SOLVED]
I put the wallpaper changing script in /etc/cron.hourly and that where the problem is. When I put the script in "crontab -e", it works.
Offline
Great. Don't forget to edit the title of the thread to mark it [SOLVED] as well.
I laugh, yet the joke is on me
Offline
where do I go to edit the thread title...I don't think I have permission to do so.
Offline
Just edit your first post.
To know or not to know ...
... the questions remain forever.
Offline