Server Fault is a question and answer site for system and network administrators. 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

How can I log the output of a command executed by at?

This command is actually being exec()'d by PHP as in:

exec('echo "curl -k https://localhost/projekt/crons/purge/5" | at now + 5 minutes');

I need to capture the response from the curl request and log it to a file. The man pages state:

The user will be mailed standard error and standard output from his commands, if any. Mail will be sent using the command /usr/lib/sendmail. If at is executed from a su(1) shell, the owner of the login shell will receive the mail.

Who owns the mail (www-data?), and how can I access it? Are the docs referring to OS mail belonging to a user, or, actual email? Thanks!

share|improve this question
up vote 3 down vote accepted

Try this:

$ echo "curl -k https://localhost/projekt/crons/purge/5 > projekt.log 2>&1" | at now + 5 minutes

share|improve this answer
Works great, thanks for putting me on the right path. I found >>is append whereas > is (over)write. Thanks. The other option, I suppose, would be to just write the log file using PHP inside the call to https://localhost/projekt/crons/purge/5. Cheers. – Jordan Arseno Aug 27 '12 at 17:47

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.