Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 407
  • Last Modified:

linux AT to send mail to another user

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
0
penguins_rule
Asked:
penguins_rule
  • 2
  • 2
  • 2
  • +1
1 Solution
 
n2fcCommented:
Pipe the output to mailx to send to multiple users...

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

Note:
You MIGHT still need the -M flag to suppress a duplicate email to the submitter... Try it & see!
0
 
penguins_ruleAuthor Commented:
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?
0
 
n2fcCommented:
You can use a .forward file...

Check out the vacation command in your Linux manual...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gheistCommented:
Why dont you include "logger" command in your script and let interested read the log?
0
 
NickUpsonSenior Network EngineerCommented:
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
0
 
penguins_ruleAuthor Commented:
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?
0
 
NickUpsonSenior Network EngineerCommented:
as soon as the "newaliases" command is run, all email will be redirected
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now