Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

5 Answers 5

up vote 3 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

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 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.