Results 1 to 10 of 27

Thread: Cron not running any jobs in Lucid

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Beans
    33

    Cron not running any jobs in Lucid

    I use crontab for a daily alarm clock, which stopped working after I moved to Lucid.

    Code:
    $ crontab -l
    # m h  dom mon dow   command
    50 7 * * * /home/jeff/alarm.sh
    In an effort to demonstrate that cron wasn't running anything, I tried this:

    Code:
    $ crontab -l
    # m h  dom mon dow   command
    */1 *   *   *   *   /usr/bin/gedit
    Which didn't run anything ever.

    Looking at some of the concepts described here, I next looked at if crontab was being read.

    Code:
    $ ls -lut /etc/crontab
    -rw-r--r-- 1 root root 724 2010-05-10 11:02 /etc/crontab
    11:02 is about when I turned on the computer, and long before many edits to the crontab file.

    When did cron run, though?
    Code:
    $ ls -lut /etc/init.d/cron
    lrwxrwxrwx 1 root root 21 2010-05-10 14:35 /etc/init.d/cron -> /lib/init/upstart-job
    That's after I turned on the computer, but what's this upstart-job business? I know upstart is something Ubuntu has started to use, but I know nothing about it.

    I also tried reassigning the crontab file with "crontab -u jeff new-crontab-file", but it didn't change any behavior.

    Thoughts? Thanks!
    Last edited by Eltern; May 11th, 2010 at 03:37 AM.

  2. #2
    Join Date
    Apr 2010
    Beans
    129
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Cron not running any jobs in Lucid

    I assume you are using sudo crontab -e to edit the crontab file...

    Have you checked if cron is still running?
    ps aux|grep cron

    Check if cron is mentioned in any log files
    grep -r 'cron' /var/log

    Your gedit test might not work because it is interactive. Try something like
    */1 * * * * /bin/date >> /test.txt

  3. #3
    Join Date
    Dec 2005
    Beans
    33

    Re: Cron not running any jobs in Lucid

    Ah! I forgot "export DISPLAY=:0 &&"! Thanks.

    For future people who find this post, you need it to look something like this:

    Code:
    $ crontab -l
    # m h  dom mon dow   command
    32 22 * * * export DISPLAY=:0 && /home/jeff/alarm.sh
    More information here.
    Last edited by Eltern; May 11th, 2010 at 03:37 AM.

  4. #4
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,510
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Cron not running any jobs in Lucid

    Quote Originally Posted by Eltern View Post
    Ah! I forgot "export DISPLAY=:0 &&"! Thanks.

    For future people who find this post, you need it to look something like this:

    Code:
    $ crontab -l
    # m h  dom mon dow   command
    32 22 * * * export DISPLAY=:0 && /home/jeff/alarm.sh
    More information here.
    Then mark the thread.
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

  5. #5
    Join Date
    May 2006
    Beans
    4

    Cool Re: Cron not running any jobs in Lucid

    The display export does not explain why cron jobs are not running. I am having the problem of cron absolutely not working *only since upgrading to Lucid*. To see if cron was working or not, I added a cron job to /etc/crontab:

    Code:
    */5 * * * * root /bin/echo 3 > /proc/sys/vm/drop_caches
    Memory cache is not changed, so that didn't work. Next I tried adding the same thing via "crontab -e", also with no luck.

    Just to be sure I wasn't losing it, I tried this as well - still no luck.

    Code:
    * * * * * root /usr/bin/touch /root/crontwatch.txt
    File does not even generate.
    Yes - cron is running:

    Code:
    root@glebel:/etc/init# ps aux | grep cron | head -1
    root     10221  0.0  0.0   3836  1008 ?        Ss   08:44   0:00 cron

    I admit I know nothing about upstart. So I read the screen and follow the output:

    Code:
    root@glebel:/etc/init# /etc/init.d/cron status
    Rather than invoking init scripts through /etc/init.d, use the service(8)
    utility, e.g. service cron status
    
    Since the script you are attempting to invoke has been converted to an
    Upstart job, you may also use the status(8) utility, e.g. status cron
    cron stop/waiting
    root@glebel:/etc/init# status cron
    cron stop/waiting
    I have no clue as to what I need to do to get cron to actually work. I read your post, about the console - but since neither of these have anything to do with a display, I just wanted to find out if there is some magic to getting cron functionality back. The same cron entries work in both via "/etc/crontab" as well as with "/usr/bin/crontab -e" on my laptop which is still running Hardy and init.d scripts.

    Any pointers for an upstart clueless noob?

  6. #6
    Join Date
    May 2006
    Beans
    4

    Re: Cron not running any jobs in Lucid

    I've been searching around in the forums. A lot of issues with cron on Lucid, but no real answers.
    Also searched around on 'the google', but no good responses either...
    Is it possible to *NOT* use upstart in Lucid?

  7. #7
    Join Date
    Nov 2008
    Beans
    482

    Re: Cron not running any jobs in Lucid

    Quote Originally Posted by grenobel View Post
    Code:
    * * * * * root /usr/bin/touch /root/crontwatch.txt
    Okay, that syntax is okay for /etc/crontab, but I actually
    never used that one.
    When running "crontab -e" to edit a crontab you should
    be editing a crontab file that doesn't need the user name.
    So the input line for "crontab -e" should be
    Code:
    * * * * * /usr/bin/touch /root/crontwatch.txt
    But I'm not sure that is the root cause for all the trouble ...

    I never changed /etc/crontab and I just did
    a "crontab -e" for the default user (not root) and
    the touch worked fine (/home/myuser/cron_is_working.out)

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
  •