Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
hey all, I am having a little issue with mail being sent to me to: /var/spool/mail/josh (where josh is my username).
I understand this is happening because of something i have done in a script i have written, where i have the output of some commands being redirected to another file. Everytime the script execute, which i have a cron running every 5 min, i get this message:
you have new mail in /var/spool/mail/josh
Is there a way to stop mail from automatically being sent to me??? how can i stop this??
Or, in other words:
-If you don't want the output to be delivered by mail, what is the difference in not outputing anything and outputing something to a place nobody can ever see? How you can distinguish the two from eachother?
What is wrong with adding "> /dev/null" to the end of your line in crontab to make your script to not output anything?
Which is placed in an other file for my own interests.
echo $temp >> /home/josh/recordtemp
also in the scipt, (just for argument sake), if i want to echo something out to the terminal. and NOT have it sent to /var/spool/mail/josh, is this possible??? Adding > /dev/null to the end of the echo line, will prevent anything from being output to the term window??? Thanks.
Maybe I'm I missing something here.
If you ask: Can a cron job output something to the terminal, then answer is no. Why not? Because it has no terminal where to output; cron has no way to know which of the (maybe open) ttys the output should be directed to.
If you ask: Can a cron job work without sending me mail all the time, then answer is yes. That can be archieved eg. by using the methods described above.
If you are trying to figure out how to do something else, you probably have to explain some more and/or again.
THANKS!! i think my issue is now cleared up.. any other, for instances, echo statements contained anywhere within the script will not generate output to the terminal, nor will i be sent mail to /var/spool/mail/USER... If this is correct. haha, i am all set in my ways. thanks for the clarificiation.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.