linux AT to send mail to another user

Posted on 2014-10-09
Last Modified: 2014-10-10
I use the  at  command to run a job. Since the user Patty has logged off, it automatically creates a mail to the user. The Patty never reads her mail. Is there a way to send the mail to another user instead? I know I can use the -M to suppress the mail, but someone else (penguin) still needs to know the job has run

Patty runs the command
at -f run_nightly_job now + 3 hours

user penguin needs to get the mail
Question by:penguins_rule
  • 2
  • 2
  • 2
  • +1
LVL 19

Expert Comment

ID: 40370655
Pipe the output to mailx to send to multiple users...

at -f run_nightly_job now + 3 hours | mailx -s "Nightly Job" Patty Penguin

You MIGHT still need the -M flag to suppress a duplicate email to the submitter... Try it & see!

Author Comment

ID: 40371070
Is there a way to get the contents of the original mail which has the results of the nightly job to be sent to Penguin?

Or a way to forward all mail from Patty to Penguin?
LVL 19

Expert Comment

ID: 40371449
You can use a .forward file...

Check out the vacation command in your Linux manual...
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

LVL 61

Expert Comment

ID: 40372308
Why dont you include "logger" command in your script and let interested read the log?
LVL 19

Accepted Solution

NickUpson earned 500 total points
ID: 40373124
you can add a line to /etc/aliases (don't forget to run newaliases afterwards) which sends all mail from Patty to Penguin

patty: penguin

Author Comment

ID: 40373266
adding line in /etc/aliases gives me what i'm looking for.

Patty has an at which is scheduled for next Monday. Will the mail automatically go to penguin, or does the at command have to be killed and restarted?
LVL 19

Expert Comment

ID: 40373346
as soon as the "newaliases" command is run, all email will be redirected

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Notice: Undefined variable 5 54
Is this bug still active in RHEL 2 30
Linux Scripting 3 53
AWS vpc peering connection 1 11
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. Once you open the link you will see …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now