2

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

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

<?php
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!

1 Answers1

3

Try this:

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

quanta
  • 52,423