We help IT Professionals succeed at work.

suppress mail sent by batch or at command in linux

Last Modified: 2014-10-14
i have several batch or at jobs being scheduled every 3 minutes. Is it possible to suppress the mail being sent to the user who initially starts the job? I don't need to know anything about the job.

The user issues command:
  batch_the_command now + 3 minutes
Watch Question

You should be able to add a  >/dev/null 2>&1 to the end of the command to prevent it from sending an email


it still created the mail
it did not show the job-id of the original command

if this is a crontab job you have to edit the job in the crontab via crontab -e. Otherwise, I'm not sure how this job runs or is scripted. It may be hard coded into the script.


$ cat batch_the_command
echo "This is the list of things to do for minute"

The command and response:
$ at -f /home/penguin/batch_the_command now
job 2174 at 2014-08-11 16:46

You have new mail
$ mail
& t
Message  1:
From penguin@localhost  Mon Aug 11 16:46:12 2014
Return-Path: <penguin@localhost>
X-Original-To: penguin
Delivered-To: penguin@localhost
Subject: Output from your job     2174
To: penguin@localhost
Date: Mon, 11 Aug 2014 16:46:12 -0400 (EDT)
From: penguin@localhost (penguins_rule)
Status: R

This is the list of things to do for minute

Open in new window


How would I set it up in cron to run every three minutes and no email?
Topic Advisor
Most Valuable Expert 2016
This one is on us!
(Get your first solution completely free - no credit card required)
Gerwin JansenTopic Advisor
Most Valuable Expert 2016

Some more details about at:

gerwin@ubuntu:~$ at -?
at: invalid option -- '?'
Usage: at [-V] [-q x] [-f file] [-mMlbv] timespec ...
       at [-V] [-q x] [-f file] [-mMlbv] -t time
       at -c job ...
       atq [-V] [-q x]
       at [ -rd ] job ...
       atrm [-V] job ...

Note the -M option

From man at:

       If a job is submitted to a queue designated with an  uppercase  letter,
       the  job is treated as if it were submitted to batch at the time of the
       job.  Once the time is reached, the batch processing rules with respect
       to  load average apply.  If atq is given a specific queue, it will only
       show jobs pending in that queue.

       -m      Send mail to the user when the job has completed even if  there
               was no output.

       -M      Never send mail to the user.

       -f file Reads the job from file rather than standard input.

       -t time run the job at time, given in the format [[CC]YY]MMDDhhmm[.ss]


thank you for the man page on at command. I did not realize RedHat Linux and ubuntu had different switches. The -M switch did not show on my man page, but it still works.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.