Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Linux Mint 13. Cron task is not working

  1. #1
    Join Date
    Nov 2009
    Beans
    25

    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?

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    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.

  3. #3
    Join Date
    Nov 2009
    Beans
    25

    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
    Last edited by retano; August 4th, 2012 at 10:10 AM.

  4. #4
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    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

  5. #5
    Join Date
    Oct 2004
    Location
    Denmark - Scandinavia
    Beans
    19,553
    Distro
    Ubuntu Budgie Development Release

    Re: Linux Mint 13. Cron task is not working

    Moved to Other OS/Distro Talk.

  6. #6
    Join Date
    Nov 2009
    Beans
    25

    Re: Linux Mint 13. Cron task is not working

    Quote Originally Posted by spjackson View Post
    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

  7. #7
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    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?

  8. #8
    Join Date
    Nov 2009
    Beans
    25

    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?

  9. #9
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Linux Mint 13. Cron task is not working

    Quote Originally Posted by retano View Post
    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?

  10. #10
    Join Date
    Nov 2009
    Beans
    25

    Re: Linux Mint 13. Cron task is not working

    Quote Originally Posted by spjackson View Post
    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

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •