LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-30-2005, 05:30 PM   #1
bomix
LQ Newbie
 
Registered: Mar 2005
Location: Denmark
Distribution: Fedora Core 4 64bit
Posts: 22

Rep: Reputation: 15
Question How to avoid mail from at scheduled job?


How do avoid getting a mail with the output from scheduled tasks?

I have this script that runs at different intervals. To do this it reschedules itself with the at command, like this:

Code:
echo $COMMAND | at now + <interval>
When that executes, it writes "job xxx at yyyy-mm-dd hh:mm" on stdout (i guess?), and this output is then put in a mail to me. I don't need to get this output, so how do I avoid getting these mails?

Thanks.

I'm sorry if this question has been asked before, but I wasn't able to get any meaningful search results.
 
Old 06-30-2005, 05:51 PM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
Just redirect the output to /dev/null, youll never hear from it again... (;

Code:
echo "$COMMAND > /dev/null" | at now + <interval>
This will only redirect standard output, so any errors weill still get mailed to you. If you redirect also standard error it would look like this:
Code:
echo "$COMMAND > /dev/null 2>&1" | at now + <interval>
The quotes arew important, otherwise the echo would go to devnull instead of the output.. (;
 
Old 06-30-2005, 06:14 PM   #3
bomix
LQ Newbie
 
Registered: Mar 2005
Location: Denmark
Distribution: Fedora Core 4 64bit
Posts: 22

Original Poster
Rep: Reputation: 15
Thanks, you led me onto the right track...
Although your redirection-suggestions doesn't actually work as I intended... The message I kept getting was the output from the at command, so to avoid the mails, the command must be like this:

Code:
echo "$COMMAND" | at now + <interval>  > /dev/null 2>&1
Thanks
 
Old 06-30-2005, 06:22 PM   #4
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
Oooh, now it hit me, yeah now I understand what you actually meant.. hehe.. stupid me.. (:

Well, Im glad I was of help even tho I didnt understand the actual problem.. (;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What does cron do if machine is down when job is scheduled? Utah Linux - Software 4 08-24-2005 07:23 PM
guaranteed scheduled job execution Xstack Programming 4 02-15-2005 10:30 PM
Sendmail: How can I avoid some users send mail to outside domains? lordphantom82 Linux - Software 0 11-16-2004 07:23 PM
How to avoid the password when a mail sends out fidelis Linux - Security 1 09-13-2004 07:47 AM
need only cron job mail on my mail id manojthakkar Linux - Newbie 0 12-20-2003 05:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration