Solved

linux AT to send mail to another user

Posted on 2014-10-09
7
399 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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 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
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Title # Comments Views Activity
Linux Hosting 16 107
Redhat upgrade 1 69
Reject incoming email for specific user - postfix 10 79
Remote ARP query 1 6
The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.
Suggested Courses

752 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