LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   quotacheck & mail incompatibility (https://www.linuxquestions.org/questions/linux-software-2/quotacheck-and-mail-incompatibility-4175660665/)

l0f4r0 09-10-2019 08:32 AM

quotacheck & mail incompatibility
 
Hello,

Here is a mystery.
My script is the following:
Code:

#!/bin/bash
set -xv
quota_report=$(mktemp)
{ quotaoff -va && quotacheck -vafmn; quotaon -va; } &>$quota_report
mail -s "[QUOTA] [$(uname -n)] Mise à jour des quotas" "root@localhost" <"$quota_report"
echo "rc=$?"

Output seems ok, temporary file is created and its content is OK but NO email is sent (I have nothing in inbox, spam or any folder).
Quote:

Originally Posted by output
quota_report=$(mktemp)
++ mktemp
+ quota_report=/tmp/tmp.tmZYsMCkLp
echo "quota_report=$quota_report"
+ echo quota_report=/tmp/tmp.tmZYsMCkLp
quota_report=/tmp/tmp.tmZYsMCkLp
{ quotaoff -va && quotacheck -vafmn; quotaon -va; } &>$quota_report
mail -s "[QUOTA] [$(uname -n)] Mise à jour des quotas" "root@localhost" <"$quota_report"
++ uname -n
+ mail -s '[QUOTA] [MDSSRV001] Mise à jour des quotas' root@localhost
echo "rc=$?"
+ echo rc=0
rc=0

Quote:

Originally Posted by /tmp/tmp.tmZYsMCkLp
+ quotaoff -va
/dev/sda1 [/]: user quotas turned off
/dev/sda5 [/home]: user quotas turned off
+ quotacheck -vafmn
quotacheck: Scanning /dev/sda1 [/] quotacheck: Old group file name could not been determined. Usage will not be subtracted.
quotacheck: Checked 20766 directories and 217679 files
quotacheck: Scanning /dev/sda5 [/home] done
quotacheck: Old group file name could not been determined. Usage will not be subtracted.
quotacheck: Checked 488 directories and 1351 files
done
+ quotaon -va
/dev/sda1 [/]: user quotas turned on
/dev/sda5 [/home]: user quotas turned on

If I just modify:
Code:

{ quotaoff -va && quotacheck -vafmn; quotaon -va; } &>$quota_report
into:
Code:

{ quotaoff -va; quotaon -va; } &>$quota_report
Mail is sent as expected initially.
quotacheck seems to be problematic for mail...

Can somebody explain me this behavior please?
Thanks in advance :)

PS: how can I inspect mail logs with journalctl please? I'm using exim4

MadeInGermany 09-12-2019 01:59 AM

One question:
what is the purpose of running quotacheck?
It is high stress for the disk.

l0f4r0 10-01-2019 12:28 PM

Ok, I've spotted the error thanks to switch -v added to command mail:
Code:

T=remote_smtp: message is too big (transport limit = 1)
Indeed, quotacheck is somewhat interactive as its output displays a kind of ASCII spinning wheel while user is waiting for it to check quotas. Thus each step of this spinning wheel is decomposed of non printable |/-\ characters (like sprites) in my $quota_report redirected output file and I end up with too long lines inside the file (when waiting time has been very long) to be sent by mail.

I know there is flag IGNORE_SMTP_LINE_LENGTH_LIMIT you can set to 1 in exim4 config files but I've simply switched to mutt instead of mail command in my script.
Problem resolved :)

Quote:

Originally Posted by MadeInGermany (Post 6035933)
One question:
what is the purpose of running quotacheck?
It is high stress for the disk.

I want to verify there is no discrepancies with my samba shared quotas. Is it bad practice?


All times are GMT -5. The time now is 01:43 AM.