Results 1 to 6 of 6

Thread: Cron Broken?

  1. #1
    Join Date
    Feb 2008
    Location
    Oklahoma, US
    Beans
    306
    Distro
    Ubuntu Studio 10.04 Lucid Lynx

    Arrow [Solved] Cron Broken?

    For a while now, I've left my pc on at night to do a few cron jobs, but none of them get done. Afterwords, whenever I type (sudo) crontab -e, I get an empty crontab. However, I noticed that the filepath for the crontab is in /tmp/cron.(ramdom 6 letters)/crontab. Should this occur? I guess the question is where should the crontab be, and how do I get cron to read it? Should/Can I reinstall cron?

    Thanks a TON for your help!

    SH
    Last edited by ShinHadoken; August 27th, 2008 at 11:52 PM.

  2. #2
    Join Date
    Feb 2008
    Location
    Oklahoma, US
    Beans
    306
    Distro
    Ubuntu Studio 10.04 Lucid Lynx

  3. #3
    Join Date
    Jan 2008
    Beans
    4,757

    Re: Cron Broken?

    What jobs are you trying to run?

    Regards
    Iain

  4. #4
    Join Date
    Nov 2007
    Location
    Wisconsin
    Beans
    1,139

    Re: Cron Broken?

    For many cron jobs, you don't need sudo.
    For a user, simply use 'crontab -e' (no sudo)
    If you really need to add an admin or root cron job, add it to the existing crontab at /etc/crontab or put a link to your script in the cron.hourly/daily/weekly/monthly folders

    COMMON ISSUES:
    - If you enter an invalid crontab entry, crontab will tell you upon exit but the warning message is easy to miss.
    - A crontab entry with a truncated path (foo instead of /bin/foo) will fail.
    - A crontab entry that is too complex, or requires shell commands that are not available to cron (but are available to you) will fail.

    HOW TO TEST CRON:
    Do a user-level 'crontab -e' and enter the following:
    Try it as a shell command to make sure it works!
    Code:
    * * * * * DISPLAY=:0.0 /usr/bin/gnome-terminal -x top
    Once each minute, a new window should spawn and run 'top'
    If it does, your cron is working just fine.

    IF YOUR CRON IS WORKING:
    Try your crontab again as a user - but not for the middle of the night.
    If it still doesn't work, post the crontab for us to see.

    IF YOUR CRONTAB IS NOT WORKING:
    Reinstall using:
    Code:
    sudo apt-get reinstall cron anacron
    Last edited by Cheesehead; September 1st, 2008 at 01:04 PM.

  5. #5
    Join Date
    Feb 2008
    Location
    Oklahoma, US
    Beans
    306
    Distro
    Ubuntu Studio 10.04 Lucid Lynx

  6. #6
    Join Date
    Feb 2008
    Location
    Oklahoma, US
    Beans
    306
    Distro
    Ubuntu Studio 10.04 Lucid Lynx

    Re: Cron Broken?

    Well, I did your little test and found that cron was NOT working. So, I decided I'd save myself some pain, and go ahead and reinstall cron and anacron. That appears to have fixed the problem. I don't know what the deal was, but I'm just glad it's fixed.

    Thanks!

    SH

Tags for this Thread

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
  •