Problem Description:
This cron job
‘’’
0 18 * * 5 export DISPLAY=:0.0; gedit System/Msgs/RNS
‘’’
does not work since I upgraded from 18.04 LTS. Before that it opened the RNS file in a gedit window at 6pm every Friday
Screenshots or Error Messages:
The error messsage I have managed to capture is
‘’’
(gedit:19290): Gtk-WARNING **: 20:22:01.861: cannot open display: :0.0
Authorization required, but no authorization protocol specified
‘’’
The second line, about authorisation, does not always appear.
What I’ve Tried: I have run the following variant to capture the error messages
‘’’
To see if you are using the correct dispaly, open terminal and run: echo $DISPLAY and if it shows :0 that’s not the problem.
If you want to open a file in gedit or another text editor, you need to indicate the path so it can be found. You are showing gedit looking for a file at System/Msgs/RNS so where exactly is that file? Do you have an actual System directory and if so where is it? If it is in the / (root of the filesystem) you would need to prefix the path with /.
I tested this by creating a System directory in my /home/user directory, then a Msgs directory in System and a file named RNS in the Msgs directory and the entry below opened the file with gedit:
That does not immediately work for me.
However, I realise that, since the update, read access to all my files (ie everything in Home) is restricted to me. I need to properly explore/fix this, alas when real life permits.
I have now tried this after ensuring that the RNS text file is readable by everybody. It does not work for me. The logfile (/var/log/syslog ) gives the error message “(No MTA installed, discarding output)”
Do an online search for that error and you will find a number of sites discussing it such as the one at the ink below. It should not effect the cron job output. MTA is mail transfer agent.
What I really want this cron job to do is to display a text message on the screen. (eg “backup will run automatically in 30 minutes, Please ensure that the removable back up device is connected”). I could use notify (but that is too transient) or email (but that would not usually get my attention) so I opted for opening a text file with gedit (my default, but apparently obsolescent, text editor).
Thank you for your help. I agree that the MTA message is a red herring - I don’t see why the presence or otherwise of an MTA stops a cron job from working.
I’m afraid we both remain puzzled
Try this instead of having it pop-up a text editor:
zenity --title "Backup Notification" \
--info \
--text="Backup will run automatically in 30 minutes. \
Please ensure that the removable backup device is connected."
That is exactly what I want to do, and it works from the command line. But when I put it in a cron job I get an error
“(zenity:17030): Gtk-WARNING **: 22:15:01.903: Failed to open display”