Cron executed, but doesn't show anything (GUI) [SOLVED]

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
alLa
Level 1
Level 1
Posts: 35
Joined: Thu Feb 12, 2015 8:13 am

Cron executed, but doesn't show anything (GUI) [SOLVED]

Post by alLa »

Hi!

I don't know what else to try... I installed a cron job, which seems to be executed (see syslog), but doesn't really do anything... Here is what I did:

$ crontab -l

Code: Select all

...
# m h  dom mon dow   command

* * * * * opera
* * * * * /usr/bin/opera
* * * * * /home/al/MOI.sh
also tried as root:
$ sudo crontab -l

Code: Select all

... 
# m h  dom mon dow   command

* * * * * opera
* * * * * /usr/bin/opera
* * * * * /home/al/MOI.sh
MOI.sh (has execution rights):

Code: Select all

#!/bin/bash

opera
/usr/bin/opera
in syslog it seems that everything is executed, but nothing happens...:
$ grep CRON /var/log/syslog

Code: Select all

Feb  3 09:30:01 al-st11-mint17 CRON[10948]: (al) CMD (opera)
Feb  3 09:30:01 al-st11-mint17 CRON[10949]: (al) CMD (/usr/bin/opera)
Feb  3 09:30:01 al-st11-mint17 CRON[10951]: (al) CMD (/home/al/MOI.sh)
Feb  3 09:30:01 al-st11-mint17 CRON[10952]: (root) CMD (/usr/bin/opera)
Feb  3 09:30:01 al-st11-mint17 CRON[10955]: (root) CMD (/home/al/MOI.sh)
Feb  3 09:30:01 al-st11-mint17 CRON[10960]: (root) CMD (opera)
Feb  3 09:30:01 al-st11-mint17 CRON[10944]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:30:01 al-st11-mint17 CRON[10943]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:30:01 al-st11-mint17 CRON[10946]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:30:01 al-st11-mint17 CRON[10947]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:30:01 al-st11-mint17 CRON[10945]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:30:01 al-st11-mint17 CRON[10942]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11068]: (root) CMD (/home/al/MOI.sh)
Feb  3 09:31:01 al-st11-mint17 CRON[11069]: (al) CMD (/usr/bin/opera)
Feb  3 09:31:01 al-st11-mint17 CRON[11076]: (al) CMD (/home/al/MOI.sh)
Feb  3 09:31:01 al-st11-mint17 CRON[11073]: (root) CMD (/usr/bin/opera)
Feb  3 09:31:01 al-st11-mint17 CRON[11074]: (al) CMD (opera)
Feb  3 09:31:01 al-st11-mint17 CRON[11075]: (root) CMD (opera)
Feb  3 09:31:01 al-st11-mint17 CRON[11063]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11067]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11066]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11064]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11065]: (root) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Feb  3 09:31:01 al-st11-mint17 CRON[11062]: (al) MAIL (mailed 1 byte of output; but got status 0x00ff, #012)
Shouldn't there be a lot of opera-windows open every minute? The sh-file and commands all work when executed manually in terminal...
Sorry, I just don't get it...

(And yes, of course I don't want opera to open a thousand times :lol: I was just looking for a simple way to test and find the problem...)

Thanks a lot,
al
Last edited by alLa on Wed Feb 03, 2016 6:19 am, edited 1 time in total.

User avatar
LinuxJim
Level 5
Level 5
Posts: 659
Joined: Tue Jan 26, 2016 8:01 pm
Location: Oregon, USA

Re: Cron executed, but doesn't do anything

Post by LinuxJim »

If you're trying to run a GUI program from cron, you have to tell it what display to attach to in the crontab:

Code: Select all

export DISPLAY=:0

alLa
Level 1
Level 1
Posts: 35
Joined: Thu Feb 12, 2015 8:13 am

Re: Cron executed, but doesn't do anything

Post by alLa »

Hi LinuxJim,

Thanks a lot - that helped a lot! Don't know, why I didn't read that before, sorry...
That does the trick now (at least for me):

Code: Select all

* * * * * DISPLAY=:0 opera
OR

Code: Select all

* * * * * export DISPLAY=:0 && opera
(Following the hint I found some good information in German here: https://wiki.ubuntuusers.de/Cron/)

Thanks! Best,
al

Post Reply

Return to “Software & Applications”