xfdesktop in a cron job

Tyler Durden tylerdu at bounced.me
Thu Nov 24 23:14:43 CET 2011


On 24.11.2011 23:11, houghi wrote:
> 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.
>

The trouble I see is that env. var. DISPLAY is not actually propagated 
to the xfdesktop if you put it that way. Try it like this:

* * * * * DISPLAY=:0.0 /usr/bin/xfdesktop --reload

or

* * * * * env DISPLAY=:0.0 /usr/bin/xfdesktop --reload

(untested)
-- 
Tyler



More information about the Xfce mailing list