When I schedule a command with 'at', can I change where the output is mailed to?
When I schedule a job/command with at
to be executed in the future, the standard output and error of the command is “mailed” to the user that did the scheduling.
So after my job runs, I get a message in the command prompt
You have mail in /var/spool/mail/mattb
which I can then read with mail
.
Is it possible to have the output instead sent to my corporate mailbox (i.e. mattb@company.com
), rather than the local user’s /var/spool/mail
?
How does at
know which address to email the output of the command, or does it only know how to place a message in the user’s /var/spool/mail
?
at
will typically use your installed mail transport agent (MTA) to deliver the mail. If you do not use local mail on the box at all, you can configure your MTA to forward all mail to another server.
Alternatively you can use a .forward file for a single user. If you put “mattb@company.com” in ~mattb/.forward then your MTA should forward your email there.