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.

I am trying the Cron facility in Mac OS X Lion, but it does't seem to work.

The crontab looks like this:

MacBook-Air-de-Vincent:run vincentle$ crontab -l
MAILTO=bxxxxxxxx@gxxx.com
* * * * * (echo 'plop')
MacBook-Air-de-Vincent:run vincentle$ 

I would expect to see a "plop" written in the terminal every minute but I do not.

Why do I not see this?

share|improve this question

migrated from stackoverflow.com Mar 10 '12 at 14:27

This question came from our site for professional and enthusiast programmers.

2  
Why would you expect Cron to write to your terminal? You've provided a MAILTO. Have you checked your inbox? –  Johnsyweb Mar 10 '12 at 10:52
    
As an aside, the parentheses around the command line are superfluous. –  tripleee Mar 10 '12 at 11:08
    
For what I've read, MAILTO is supposed to send debug email. –  user777466 Mar 10 '12 at 14:10

3 Answers 3

fwiw, cron is deprecated in Lion.

You should look to switch from cron to launchctl.

share|improve this answer
    
Please give an example of how to achieve the same using launchctl. –  slhck Mar 10 '12 at 14:54
    
Please specify the official source for cron deprecation. –  Daniel Beck Jul 14 '12 at 14:55
1  
Be sure to read past the initial blurb, to the section, "Timed jobs using cron". developer.apple.com/library/mac/documentation/MacOSX/Conceptual/… –  Snips Jul 15 '12 at 15:58
    
@DanielBeck deprecated is such an ugly word. They simply added something else, left cron there, favor the new thing then call it 'deprecated'. Using on cron on Mavericks now. Deprecated? Not yet. Expect it to be there at least a few more foreseeable releases? Yes. See here for answer to your question That article is from 2005 and we still have cron –  Michael.M Oct 6 at 16:46
    
@Michael.M: Are you sure you wanted to respond to me? –  Daniel Beck Oct 6 at 16:49

Cron is deprecated however crontab is not. Run man crontab and that'll give you what you want to know.

share|improve this answer
    
Am I confused or is he already using crontab? –  Tanner Oct 24 '12 at 19:56

Besides whether or not cron is deprecated, this would not do what you want, not even in Linux.

Cron runs as a background process. The specific type is called a 'daemon' (pronounced demon). As such it has no terminal, and no terminal to write to. Its stdout and stderr are hooked to mail. Normally, you'd drop to your local inbox on your computer, but you've supplied a MAILTO setting, which redirects mail to that email address. This setup should send an email consisting solely of 'plop' to bxxxxxxxx@gxxx.com, every minute. All output goes to this mail, not just debugging output.

For testing, I usually do a touch file someplace in /tmp. A cronjob of date > /tmp/testdate.txt or equivalent will show you if and how often your cron fires.

share|improve this answer

Your Answer

 
discard

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