From: Robert Klemme Date: 2009-05-07T06:40:05+09:00 Subject: Re: system call not working under cron On 06.05.2009 23:10, Michael Satterwhite wrote: > I have a short ruby script to periodically change the screen background > under gnome (Ubuntu Linux). Trace statements in the script show that the > script itself is running. The problem is that the system() call is not > working. Note that I'm running it as myself, not as root. The same > script works perfectly when run in a console. > > Here's the command that isn't working. > > ret = system("gconftool -t str --set > /desktop/gnome/background/picture_filename '#{new_picture}'") > > 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. Kind regards robert