Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Note: this question is not about how to edit cron tab but how to make cron work


  1. I edited my cron using env EDITOR=joe crontab -e
  2. I entered 1 * * * * echo 'test' > /Users/radek/Backup/rationalvmware/test.txt and it does nothing although the cron is set up correctly. Checked via Cronnix and viewed the cron in /var/cron/tabs. Editing crontab using Cronnix gives me the same results.

If I run echo 'test' > /Users/radek/Backup/rationalvmware/test.txt manually it creates a files as expected so I assume that the command I provide to cron is correct one.

Is there anything special I have to do to make cron work on OSX? How can I check it the the cron is running.

What's the equivalent of /var/log/messages on OSX? I can see in messages on SuSE that cron works.

share|improve this question
1  
As an aside: note that cron runs in a different environment than your own test command would. For example: you might often need absolute paths. – Arjan Feb 10 '11 at 8:05
up vote 7 down vote accepted

I doubt you waited until 1 minute past the hour for your test. To run every minute:

0-59 * * * * echo 'test' > /Users/radek/Backup/rationalvmware/test.txt
share|improve this answer
    
From Mavericks or later, an alternative sending yourself a notification 0-59 * * * * osascript -e "display notification \"$(date)\" with title \"Cron test\"" – wardw Mar 8 at 13:17

The cron utility is launched by launchd when it sees the existence of /etc/crontab or files in /usr/lib/cron/tabs. There should be no need to start it manually. (See the man pages.)

To see logs of OS X, you can use Console Utility.

share|improve this answer
    
On Mt. Lion that location is actually symlinked several times, leading ultimately to: /private/var/at/tabs/, FYI – Andrew Burns Aug 2 '13 at 16:54

Two other ways are to use:

*/1 * * * * echo 'test' > /Users/radek/Backup/rationalvmware/test.txt

or

* * * * * echo 'test' > /Users/radek/Backup/rationalvmware/test.txt

These both run every minute.

share|improve this answer

First, you need to set your $EDITOR variable to something reasonable, since what you did set it to something you don't want. Set it like this:

EDITOR=joe

You can change joe to another text editor, such as nanoor vim.

Then, you'll want to edit your crontab, which is done like so:

crontab -e

Then you'll put in the text for cron to use.

share|improve this answer
    
I updated my question. I can edit the cron the way I do it but the cron doesn't run.... – Radek Feb 10 '11 at 4:29
    
There's no reason joe couldn't be used. The key is that crontab -e is used. – Dennis Williamson Feb 10 '11 at 5:04
    
joe is the best – nkadwa Apr 14 '14 at 18:20

If you want to use cron on Mountain Lion you should take a look here: https://coderwall.com/p/ry9jwg or just open terminal and run sudo touch /etc/crontab. After that your jobs in /usr/lib/cron/tabs should be handled by cron.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .