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.

From the man page for at/batch, it says

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

But how do configure what email address its sent to?

In cron can use the MAILTO enviroment variable, but can't see that anywhere within at or batch.

share|improve this question
add comment

1 Answer

I don't see a way of doing that in the at invocation, but you could probably do something like this with the command you're calling via at:

 $ at 16:00
 at> some-command [arguments, &c.] 2>&1 | sendmail [-f <from-address>] <recipient>
 at> ^D

When the command runs, it will hand off its output to sendmail for delivery to the specified recipient, and in the quick test I've just run, this does work.

Of course, if you're already redirecting the output from some-command to go somewhere else, you might be out of luck -- but, then, you could always tee(1) the output, or add a final line to the at job calling sendmail to push out the message.

share|improve this answer
add comment

Your Answer

 
discard

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.