From: Robert Klemme Date: 2009-05-07T15:56:10+09:00 Subject: Re: system call not working under cron 2009/5/7 Michael Satterwhite : > Robert Klemme wrote: >> On 06.05.2009 23:10, Michael Satterwhite wrote: >>> >>> Please accept that the "new_picture" variable has a good value pointing >>> to a new background. There are traces in the program that write values >>> to a trace file that I can examine after the fact. The fact that the >>> trace file is updated also shows the script is running. >>> >>> Does anyone know why this command would work from a console, but not >>> from a cron job? >> >> This is likely due to X11's handling of permissions.  Your cron job >> simply does not have access rights to the X session.  I do not know the >> details but the man page of "xhost" may be a good starting point.  Error >> message that you get might also be a good indication. > > I didn't even know about xhost before this. According to the > documentation, the command "xhost" without arguments will list those who > have authorization for the xserver. My user id was authorized already - > still won't run from cron. If you executed the xhost command from a terminal started from your X session this comes as no surprise. You should see different results when executing from the cron job. The point is that since cron is not a child of the X server process your job does not automatically inherit certain permissions. The point is, a cron job is usually not the proper thing to update an X session because cron is something permanent while X sessions are transitional. Rather you want to start your screen updater as part of the X session initialization (~/.xinitrc IIRC). Then your process will inherit all the necessary permissions and DISPLAY will also be set properly. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/