importance of /var/mail

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting importance of /var/mail
# 1  
Old 09-01-2010
importance of /var/mail

When an entry will be made to the file /var/mail/<user-id> .

I have 100 scripts under a specific user id(dgircc) in cron .SO inrder to check the whether the script has sucessfully run or not and if not to generate an email
if i mention the code like
#!/bin/ksh -p
     2  fsize=`ls -lrt /var/mail/dgircc |awk '{print $5}'`
     3  if [ $fsize -gt 0 ] ;then
     4  more /var/mail/dgircc >> /var/mail/dgircc.old
     5  uuencode /var/mail/dgircc /var/mail/dgircc | mailx -s "dgircc report "  mailid 
     6  cp /dev/null /var/mail/dgircc
     7  fi

will this solve my requirement
Please let me know if there are any good ideas to monitor all the scripts under cron which has failed and to generate a consolidated report of those(which are failed) .

Last edited by pludi; 09-01-2010 at 05:26 AM.. Reason: code tags, please..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users


I'm not able to view my inbox mails, I'm using Thunderbird. I have checked the /var/mail/ directory files. There I saw the lock file. . I have removed the lock file and restarted the Thunderbird, again the lock file is created. I have changed the file group as mail from users. after that... (1 Reply)
Discussion started by: ungalnanban
1 Replies

2. UNIX for Dummies Questions & Answers

Parse /var/mail

Hi all... We have a box that receives a lot of incoming emails. I have a .procmailrc file that in turn invokes a python script, which process each of these incoming email. All is nice and good. However, before the .procmailrc and python script were in place, we still were receiving emails and... (0 Replies)
Discussion started by: khader69
0 Replies

3. UNIX for Advanced & Expert Users

Mail going to /var/spool/mqueue instead of being sent

Hello, I have a bunch of cron jobs in the crontab. For some reason mail from the cron jobs started going to /var/spool/mqueue instead of being sent. Does anyone know why mail from cron jobs would go to the queue instead of being sent? (9 Replies)
Discussion started by: xadamz23
9 Replies

4. UNIX for Dummies Questions & Answers


Hi, How can i get my mail on either /var/spool/mail or /var/mail? I use mail and sendmail command to send mail. But everytime I send mail it comes to my outlook inbox and when I check with mail command I get the message "No mail for siba". (Note siba is my user Id.) (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

5. UNIX for Dummies Questions & Answers

/VAR/SPOOL/MAIL question

Hi, We have all the user account in a home direcory where their mail is stored and retrieved by email clients. We do however have /var/spool/mail with all the user accounts in it as well Our is configured to use /var/spool/mqueue as the queue so .what is /var/spool/mail being used... (3 Replies)
Discussion started by: mojoman
3 Replies

6. UNIX for Dummies Questions & Answers

How to set HIGH importance to a mail sent through mailx or sendmail command

I have written a script for sending automated email, reporting the running status of a cron scheduled work. Now, the issue is, my Project Manager wants, the mail should be received with HIGH IMPORTANCE. How can I do that, kindly anybody explain. Thank you so much. (3 Replies)
Discussion started by: mitte_dino
3 Replies

7. UNIX for Dummies Questions & Answers

How do I read mail in /var/spool/mail?

How can I read mail sent to /var/spool/mail? I do not have pine installed so forget about there some generic utility I can use? (3 Replies)
Discussion started by: mojoman
3 Replies

8. Solaris

how to forward mail in /var/mail/username to external mail

Dear All, Now I use solaris 10 and I try to forward mail from /var/mail/username to their external mail so what should I do? thank u in advance (2 Replies)
Discussion started by: unitipon
2 Replies

9. UNIX for Dummies Questions & Answers

Can I zero var/spool/mail/mail

The mail file in the directory var/spool/mail is very large. Can I zero this (>) without losing any unopened mails there may be? There are about 10 mail accounts. Using RedHat Linux. Thanks in advance. (0 Replies)
Discussion started by: dennisheazle
0 Replies

10. Shell Programming and Scripting

READING mail from /var/mail/user

Hello guys, I'm in desperate need. I need to write a script that behaves like a "mail" shell program. I've a base of the program -menu and so on, but what I cannot do is how to read messages from /var/mail/user. I would like to separate them as "mail" program does, but I;m just a newbie and... (21 Replies)
Discussion started by: petoSVK
21 Replies
Login or Register to Ask a Question
CONFLICT(8)							     [nmh-1.5]							       CONFLICT(8)

conflict - search for alias/password conflicts SYNOPSIS
/usr/lib/mh/conflict [-search directory] [-mail name] [-version] [-help] [aliasfiles ...] DESCRIPTION
Conflict is a program that checks to see if the interface between nmh and the transport system is in good shape Conflict also checks for maildrops in /var/mail which do not belong to a valid user. It assumes that no user name will start with `.', and thus ignores files in /var/mail which begin with `.'. It also checks for entries in the group(5) file which do not belong to a valid user, and for users who do not have a valid group number. In addition duplicate users and groups are noted. If the -mail name switch is used, then the results will be sent to the specified name. Otherwise, the results are sent to the standard output. The -search directory switch can be used to search directories other than /var/mail and to report anomalies in those directories. The -search directory switch can appear more than one time in an invocation to conflict. Conflict should be run under cron(8), or whenever system accounting takes place. FILES
/etc/nmh/mts.conf nmh mts configuration file /etc/passwd List of users /etc/group List of groups /usr/bin/mh/mhmail Program to send mail /var/mail/ Directory of mail drop PROFILE COMPONENTS
mh-alias(5) DEFAULTS
`aliasfiles' defaults to /etc/nmh/MailAliases CONTEXT
None MH.6.8 11 June 2012 CONFLICT(8)

Featured Tech Videos