Ubuntu 8.04 upgrade: Zenity no longer displaying messages

Q In Ubuntu 7.10 I was doing automatic data backups using crontab to run Bash scripts containing Zenity messages. Since I upgraded to Ubuntu 8.04 the messages no longer display, though data backup still takes place normally. I have tried many suggestions from the internet for alternative code to display messages from crontab without success. I have tested the procedures in Linux Mint 5.0 Light and Ubuntu 7.10 on other machines and they work OK, so I suppose that this is a problem with the kernel. The hardware on my machine has not changed since these procedures were working in Ubuntu 7.10. I have been waiting in hope that a patch would arrive with the many updates to Ubuntu 8.04 but no luck so far! The command line in crontab is

16 10 * * * export DISPLAY=:0.0 && /home/bruceadmin/Scripts/dayback.sh >
/dev/null 2>&1

and export | less at a terminal shows that :0.0 is correct for my DISPLAY value.

A The first step is to remove or change the output redirection so that you are not dumping the error message your command is probably producing. Removing it will have the error emailed to you, or you could direct it to a file. If the backup script produces lots of output, you should consider redirecting stdout and stderr to different files. I suspect your error message may contain "cannot connect to X server :0.0", so you may also see rejection messages in /var/log/Xorg.0.log. Are you running this command from your user's crontab or /etc/crontab? If the latter, you need to run

xhost local:

to allow other users (/etc/crontab entries are run as root) access to your display. Alternatively, run the script as your user and use sudo within the script for any commands that need root access. Another possibility that would affect your user's crontab as well as the system one is your use of export to set DISPLAY separately from running the command. Export is only needed when commands are run separately from the settings of the environment variable and there is no need for this here. Instead use

16 10 * * * DISPLAY=":0.0" /home/bruceadmin/Scripts/dayback.sh &>/home/user/cron.log

which works perfectly on our Hardy test rig. When you're happy, change the logfile to /dev/null, but until then it can be useful for debugging.

Back to the list