Solved

linux AT to send mail to another user

Posted on 2014-10-09
7
391 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

773 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