Linux Mint 13. Cron task is not working
Hello all,
For some reason my cron job will not run. This is my setup:
retano@OptiPlex-GX520 ~ $ pgrep cron
902
retano@OptiPlex-GX520 ~ $ crontab -l
0 * * * * mate-terminal # JOB_ID_4
retano@OptiPlex-GX520 ~ $ mate-terminal
retano@OptiPlex-GX520 ~ $
So it is just a simple command to get a new terminal window and it is not working. When I run it directly from terminal - it is opened ok.
Please advise what can be wrong here?
Re: Linux Mint 13. Cron task is not working
Is this just a test, or do you have some reason to start a new terminal like this?
cron isn't related to a desktop session; it is for tasks that run in the background so long as the computer is running, whether a user is logged in or not. The cron job has nothing to tell it on which desktop to put the window.
It may be possible to set the DISPLAY variable and get it to work - I'm not sure. I wouldn't recommend you to go down that road though, unless you have a genuine need.
Re: Linux Mint 13. Cron task is not working
I am trying to get my Sikuli scripts working. They were running Ok with Mint 10, but I can't get it working with Mint 13. I also tried to use Gnome schedule as a GUI for cron setup - it did not help also.
This is headless PC with no monitor attached. I operate with it via VNC session
Re: Linux Mint 13. Cron task is not working
I'm not on Mint, but this works for me. In vnc session, start a terminal, and
Code:
$ echo $DISPLAY
:1.0
Then create a cron job with crontab -e
Code:
0 * * * * DISPLAY=:1.0 /usr/bin/lxterminal
Re: Linux Mint 13. Cron task is not working
Moved to Other OS/Distro Talk.
Re: Linux Mint 13. Cron task is not working
Quote:
Originally Posted by
spjackson
I'm not on Mint, but this works for me. In vnc session, start a terminal, and
Code:
$ echo $DISPLAY
:1.0
Then create a cron job with crontab -e
Code:
0 * * * * DISPLAY=:1.0 /usr/bin/lxterminal
Does not work :(
this is my output:
$ echo $DISPLAY
:0.0
so I insert it like this 0 * * * * DISPLAY=:0.0 mate-terminal
Re: Linux Mint 13. Cron task is not working
I have just tried it with a Mint 13 Live CD. It works for me. DISPLAY is :0 in this case.
Code:
0 * * * * DISPLAY=:0 mate-terminal
I don't know why it won't work for you. Is there any clue in /var/log?
Re: Linux Mint 13. Cron task is not working
I really don't understand what is wrong here. Tried to create a logfile with output, this is the current setting:
1 * * * * DISPLAY=:0 mate-terminal exec >> /home/log/terminal.log 2>&1
but I don't have the log file created. Why?
Re: Linux Mint 13. Cron task is not working
Quote:
Originally Posted by
retano
I really don't understand what is wrong here. Tried to create a logfile with output, this is the current setting:
1 * * * * DISPLAY=:0 mate-terminal exec >> /home/log/terminal.log 2>&1
but I don't have the log file created. Why?
Does the directory /home/log/ actually exist and is it writable by you? Does this work from a terminal?
Code:
echo hello >> /home/log/terminal.log
Is cron running? Is a CRON entry written to /var/log/auth.log when the jobs is meant to run?
Re: Linux Mint 13. Cron task is not working
Quote:
Originally Posted by
spjackson
Does the directory /home/log/ actually exist and is it writable by you? Does this work from a terminal?
Code:
echo hello >> /home/log/terminal.log
Is cron running? Is a CRON entry written to /var/log/auth.log when the jobs is meant to run?
oops I missed my login name:
echo hello >> /home/retano/log/terminal.log
is working Ok from terminal, but not as a cron job
1 * * * * DISPLAY=:0 mate-terminal exec >> /home/retano/log/terminal.log 2>&1
CRON service is running Ok:
retano@OptiPlex-GX520 ~ $ pgrep cron
936
last entries from /var/log/auth.log:
Aug 12 19:17:01 OptiPlex-GX520 CRON[13725]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 12 19:17:01 OptiPlex-GX520 CRON[13725]: pam_unix(cron:session): session closed for user root
Aug 12 19:39:01 OptiPlex-GX520 CRON[13749]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 12 19:39:03 OptiPlex-GX520 CRON[13749]: pam_unix(cron:session): session closed for user root
Aug 12 20:01:01 OptiPlex-GX520 CRON[13756]: pam_unix(cron:session): session opened for user retano by (uid=0)
Aug 12 20:01:01 OptiPlex-GX520 CRON[13756]: pam_unix(cron:session): session closed for user retano
Aug 12 20:09:01 OptiPlex-GX520 CRON[13761]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 12 20:09:03 OptiPlex-GX520 CRON[13761]: pam_unix(cron:session): session closed for user root
Aug 12 20:17:01 OptiPlex-GX520 CRON[13769]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 12 20:17:01 OptiPlex-GX520 CRON[13769]: pam_unix(cron:session): session closed for user root
Aug 12 20:39:01 OptiPlex-GX520 CRON[13843]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 12 20:39:02 OptiPlex-GX520 CRON[13843]: pam_unix(cron:session): session closed for user root