LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to avoid mail from at scheduled job? (https://www.linuxquestions.org/questions/linux-software-2/how-to-avoid-mail-from-at-scheduled-job-338867/)

bomix 06-30-2005 05:30 PM

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.

Artanicus 06-30-2005 05:51 PM

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.. (;

bomix 06-30-2005 06:14 PM

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 :)

Artanicus 06-30-2005 06:22 PM

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.. (;


All times are GMT -5. The time now is 04:33 AM.