Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check: If there are unread mail for root issue warning #39

Closed
lzap opened this issue Mar 23, 2017 · 5 comments
Closed

Check: If there are unread mail for root issue warning #39

lzap opened this issue Mar 23, 2017 · 5 comments

Comments

@lzap
Copy link
Member

lzap commented Mar 23, 2017

We have many crons, they end up in root mail folder (or file technically).

@kgaikwad
Copy link
Member

@lzap ,
I would like to know that how you find out unread mails from any user mail file like /var/spool/mail/root.
For this, are you using any mail client like mailutils or mailx.

@lzap
Copy link
Member Author

lzap commented Apr 20, 2017

Hello, root mail is stored in mbox file (regular text file) in /var/spool/mail/root, so if you find this file and it has non-zero size, you got some mail. To count number of emails, this hack is possible:

egrep '^Message-Id' /var/spool/mail/root | wc -l

If you need to know (rough) number of emails. Now if you read them (you can use mutt or mailx to do that) they will disappear from the file. Example session:

[root@fido ~]# yum install mailx^C
[root@fido ~]# sendmail root 
Subject: Test

This is a test
CTRL+D
[root@fido ~]# cat /var/spool/mail/root 
From root@fido.example.com  Thu Apr 20 14:36:31 2017
Return-Path: <root@fido.example.com>
X-Original-To: root
Delivered-To: root@fido.example.com
Received: by fido.example.com (Postfix, from userid 0)
        id 08CF728F55C2; Thu, 20 Apr 2017 14:36:31 +0200 (CEST)
Message-Id: <20170420123631.08CF728F55C2@fido.example.com>
Date: Thu, 20 Apr 2017 14:36:29 +0200 (CEST)
From: root@fido.example.com (root)

fdsfsdf

From root@fido.example.com  Thu Apr 20 14:36:53 2017
Return-Path: <root@fido.example.com>
X-Original-To: root
Delivered-To: root@fido.example.com
Received: by fido.example.com (Postfix, from userid 0)
        id C5FA628F55C2; Thu, 20 Apr 2017 14:36:53 +0200 (CEST)
Subject: Test
Message-Id: <20170420123653.C5FA628F55C2@fido.example.com>
Date: Thu, 20 Apr 2017 14:36:41 +0200 (CEST)
From: root@fido.example.com (root)

This is a test
CTRL+D

[root@fido ~]# mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/root": 2 messages 2 new
>N  1 root                  Thu Apr 20 14:36  12/407   
 N  2 root                  Thu Apr 20 14:36  14/435   "Test"
& n
Message  1:
From root@fido.example.com  Thu Apr 20 14:36:31 2017
Return-Path: <root@fido.example.com>
X-Original-To: root
Delivered-To: root@fido.example.com
Date: Thu, 20 Apr 2017 14:36:29 +0200 (CEST)
From: root@fido.example.com (root)
Status: R

fdsfsdf

& d
& n
Message  2:
From root@fido.example.com  Thu Apr 20 14:36:53 2017
Return-Path: <root@fido.example.com>
X-Original-To: root
Delivered-To: root@fido.example.com
Subject: Test
Date: Thu, 20 Apr 2017 14:36:41 +0200 (CEST)
From: root@fido.example.com (root)
Status: R

This is a test
CTRL+D

& q
Held 1 message in /var/spool/mail/root
[root@fido ~]# cat /var/spool/mail/root 
From root@fido.example.com  Thu Apr 20 14:36:53 2017
Return-Path: <root@fido.example.com>
X-Original-To: root
Delivered-To: root@fido.example.com
Received: by fido.example.com (Postfix, from userid 0)
        id C5FA628F55C2; Thu, 20 Apr 2017 14:36:53 +0200 (CEST)
Subject: Test
Message-Id: <20170420123653.C5FA628F55C2@fido.example.com>
Date: Thu, 20 Apr 2017 14:36:41 +0200 (CEST)
From: root@fido.example.com (root)
Status: RO

This is a test
CTRL+D

[root@fido ~]# mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/root": 1 message
>   1 root                  Thu Apr 20 14:36  15/446   "Test"
& d
& q
[root@fido ~]# cat /var/spool/mail/root 
[root@fido ~]# ls -la /var/spool/mail/root
-rw-------. 1 root mail 0 20. dub 14.37 /var/spool/mail/root
[root@fido ~]# 

kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Apr 21, 2017
@kgaikwad
Copy link
Member

kgaikwad commented Apr 21, 2017

@lzap, thank you for providing information.

Additional to above details, I have few things which I would like to ask for my understanding.

  • Except disk spacing consumption, what are the possible causes of unread mails.
  • What do you think, it will have an impact on any process like upgrade?

@lzap
Copy link
Member Author

lzap commented Apr 21, 2017

This has no impact on upgrade, we should have a separate free space checker perhaps.

kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Apr 24, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Apr 26, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Apr 26, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue May 4, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue May 4, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Jun 29, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Jun 29, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Jun 29, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Jul 5, 2017
@swapab
Copy link
Member

swapab commented Aug 10, 2017

Redmine issue: http://projects.theforeman.org/issues/20148

@swapab swapab closed this as completed Aug 10, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Aug 22, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Sep 8, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Sep 12, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Sep 12, 2017
kgaikwad added a commit to kgaikwad/foreman_maintain that referenced this issue Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants