xfdesktop in a cron job
TRINH Minh Hieu
mhtrinh at gmail.com
Fri Nov 25 02:32:05 CET 2011
Hi
On Fri, Nov 25, 2011 at 1:37 AM, <xfce-request at xfce.org> wrote:
> Date: Fri, 25 Nov 2011 01:33:56 +0100
> From: Guido Berhoerster <gber at opensuse.org>
> To: Xfce general discussion list <xfce at xfce.org>
> Subject: Re: xfdesktop in a cron job
> Message-ID: <20111125003356.GA2351 at hal>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> * houghi <houghi at houghi.org> [2011-11-24 23:11]:
> > I am running openSUSE 12.1 and I am running a script in cron that I used
> > to run in 11.4 as well without any problem. Also the cronjob is
> identical.
> >
> > However what used to work in 11.4 does not work in 12.1. My best guess
> > would be here.
> >
> > The script can be found here http://houghi.org/script/background It
> > basically changes the background to a one of my several thousand
> > wallpapers in several hundred directries at random. When I run the script
> > in a terminal I have no problems.
> >
> > However when I want to lauch it in a cron job, I get the folloing error:
> > Failed to parse arguments: Cannot open display
> >
> > Crontab has the following line:
> > * * * * * /usr/local/bin/background
> >
> > The problem is cause by the following line:
> > export DISPLAY=:0.0 && xfdesktop --reload
> >
> > Even when I use the following I get the same error:
> > * * * * * export DISPLAY=:0.0 && /usr/bin/xfdesktop --reload
> >
> > As far as I can tell I must use the export part to get it working.
>
> your approach is broken, there is no clean, reliable way to get
> access to your users display from cron. Instead I'd suggest you
> just convert your little script into a small daemon which can be
> started by the session. In its main loop you can let it change
> the background reliably and then sleep for the desired amount of
> time.
> --
> Guido Berhoerster
>
I also have OpenSuse 12.1 installed. I confirm that :
DISPLAY=:0.0 xfdesktop --reload
"worked". There is no error message but the wallpaper don't change. Because
"xfdesktop --reload" don't seems to not re-read the configuration file.
With Xfce 4.8, use "xfconf-query". I tried this in cron and it works :
DISPLAY=:0.0 xfconf-query -c xfce4-desktop -p
/backdrop/screen0/monitor0/image-path -s
/home/mhtrinh/myconf/vladstudio_infinity_1_gold_1366x768.jpg
Regards,
mhtrinh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/xfce/attachments/20111125/faacc3d7/attachment.html>
More information about the Xfce
mailing list