Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

linux AT to send mail to another user

Posted on 2014-10-09
7
Medium Priority
?
405 Views
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
0
Comment
Question by:penguins_rule
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 20

Expert Comment

by:n2fc
ID: 40370655
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
 
LVL 1

Author Comment

by:penguins_rule
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?
0
 
LVL 20

Expert Comment

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

Check out the vacation command in your Linux manual...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 62

Expert Comment

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

Accepted Solution

by:
NickUpson earned 2000 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
0
 
LVL 1

Author Comment

by:penguins_rule
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?
0
 
LVL 19

Expert Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

916 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