LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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

Reply
 
LinkBack Search this Thread
Old 11-18-2004, 10:53 AM   #1
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Rep: Reputation: 30
mail in /var/spool/mail/USERNAME


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??

Thanks.
josh
 
Old 11-18-2004, 10:57 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Yes there is. Don't output anything in your script.
 
Old 11-18-2004, 11:02 AM   #3
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
but if i want to, is there a way to stop the auto mail?????
 
Old 11-18-2004, 11:38 AM   #4
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Duh??
That doesn't make sense.

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?
 
Old 11-18-2004, 11:44 AM   #5
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
my wording may be off. I have a script to run :

temp = `cat /proc/acpi/thermal_zone/THRM/temperature`

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.

josh
 
Old 11-18-2004, 12:00 PM   #6
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Let's say we have a script called "a_script", and it contains:
Code:
temp = `cat /proc/acpi/thermal_zone/THRM/temperature`
echo $temp >> /home/josh/recordtemp
...other things..
and you want to run this script as itself, and you want to run it as a cronjob. Also those "other things" generate some output to the screen.

Now, to crontab, we put a line
Code:
*/5 * * * * root /usr/local/bin/a_script >/dev/null
Now the there comes no output -> no mail.

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.
 
Old 11-18-2004, 01:28 PM   #7
blizunt7
Member
 
Registered: Mar 2004
Distribution: Fedora Core 1,2,3, RHEL3,4,5 Ubuntu
Posts: 272

Original Poster
Rep: Reputation: 30
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.

Josh
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why email INBOX directory is in /var/spool/mail instead of /home/username csjonathan Linux - General 4 11-06-2008 01:14 PM
sendmail error Fetching mail could not lock /var/spool/mail/username sukhdev50 Linux - Networking 0 05-04-2005 03:41 AM
/var/spool/mail/username does not exist stimpsonjcat Debian 3 04-25-2005 12:36 PM
Postfix $HOME/mail/inbox instead of /var/spool/mail ramram29 Linux - Software 3 08-08-2004 01:28 AM
?how to make mail go to diff place than /var/spool/mail ctejas Linux - General 0 06-24-2004 12:58 AM


All times are GMT -5. The time now is 03:54 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration