0

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
[email protected]
* * * * * (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?

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

3 Answers 3

1

fwiw, cron is deprecated in Lion.

You should look to switch from cron to launchctl.

8
  • Please give an example of how to achieve the same using launchctl.
    – slhck
    Mar 10, 2012 at 14:54
  • Please specify the official source for cron deprecation.
    – Daniel Beck
    Jul 14, 2012 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, 2012 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, 2014 at 16:46
  • @Michael.M: Are you sure you wanted to respond to me?
    – Daniel Beck
    Oct 6, 2014 at 16:49
0

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

1
  • Am I confused or is he already using crontab?
    – rtf
    Oct 24, 2012 at 19:56
0

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 [email protected], 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.

You must log in to answer this question.