Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I want to schedule events for exact times in Mac OS X. It seems like the 'at' command is the simplest way to do this.

I have enabled atrun using the command:

launchctl load -w /System/Library/LaunchDaemons/

To test at, I'm using the following one-line BASH script:

echo 'foo' >> path/to/log.txt | at now + 2 minutes

When I run the script, I get output like:

job 17 at Sat May 15 12:57:00 2010

where '12:57:00' is indeed 2 minutes in the future. But the echo command executes immediately: the line 'foo' is added to log.txt right away.

How can I make at work for me?

share|improve this question
up vote 0 down vote accepted

You're doing it wrong. at reads commands from stdin as text, it cannot magically know them from a pipeline.

Your command...

echo 'foo' >> path/to/log.txt | at now + 2 minutes

...runs both echo and at at the same time, in a pipeline. (Think cat somefile | grep sometext) So at would receive the word foo on its stdin. However, the output of echo is redirected to a file, so at does not receive anything.

The correct command would be:

echo "echo 'foo' >> path/to/log.txt" | at now + 2 minutes
share|improve this answer
You're quite right—thanks for the answer and the clear explanation. – Gabe May 15 '10 at 21:00

Your Answer


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.