No mail from cron.daily on 1 server

Richard G

Verified User
Joined
Jul 6, 2008
Messages
12,560
Location
Maastricht
I'm just wondering.
We got 3 servers and on 2 of them spamassassing is running, the 3rd isn't really used for mail accounts.
On both servers the /etc/cron.daily/sa-update with the exact same date, size and content.

The /etc/crontab file on both servers have a "mailto=root" so this is also not the issue.
The /etc/aliases file is exactly the same on both servers.

Still.... when sa-update has been run daily, from 1 server I get an email from "anacron [email protected]" stating:
Anacron job 'cron.daily' on server.domain.com
which only give info about the sa-update cron in the mail which is fine.

But I would like to have my other server do the same, but don't know where to look since the above named files are the same.

Any clues?
 
Hello,

Check/update your cron settings in options.conf under custombuild folder and run ./build cron to apply changes.

sa-update from directadmin runs on daily/weekly bases if enabled in custombuild.
 
Thank you Alex.

But I already do that from the beginning after installing the server:
Code:
cron=yes
cron_frequency=daily
[email protected]
notifications=yes
da_autoupdate=no
updates=no
webapps_updates=yes

I did "./build cron" again and shows this:
Code:
/usr/local/directadmin/custombuild]# ./build cron
Cronjob is set for [email protected]:
Cronjob frequncy: daily
Automatic notifications: yes
Automatic updates: no
Installing sa-update cronjob...
Downloading             sa-update.sh...
--2018-02-01 15:09:14--  http://files18.directadmin.com/services/custombuild/sa-update.sh
Resolving files18.directadmin.com... 37.72.98.6
Connecting to files18.directadmin.com|37.72.98.6|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1254 (1.2K) [application/x-sh]
Saving to: `/usr/local/directadmin/custombuild/sa-update.sh'

100%[==========================================================================================>] 1,254       --.-K/s   in 0s      

2018-02-01 15:09:14 (100 MB/s) - `/usr/local/directadmin/custombuild/sa-update.sh' saved [1254/1254]

However, this happens every time I give that command.
But on both servers, the file /usr/local/directadmin/custombuild/sa-update.sh is non existing. There is one created in /etc/cron.daily though, but that was there before too.

The issue also isn't that the cron isn't running. It does run every day so that is fine, but I don't get a mail about it, which the other server does send. The update on this server had issues, I updated some perl scripts and now it's doesn't have errors anymore.
But it doesn't send mail to me like the other server.
 
Last edited:
Richard,

If you don't receive emails then you need to check mail logs. There are too many things to guess... probably check /etc/aliases on all the servers and see who is receiving emails for root. Errors from cron are usually sent to root by default.
 
Yes that's the odd thing, I also checked the mail logs.
Can't find anything on both servers, not in the mainlog and not in the rejectlog.

Like stated in my first post all /etc/aliases are set exactly the same and set to the same email adress. Which is functioning fine as I do get mails from root for example send via CSF from all servers.
The only thing I don't get is that mail from is from that cronjob on server 2.
The /etc/sysconfing/crond file is the same too.

Very odd. Looks as if the cronjob just isn't sending mail.
 
Last edited:
I'd rather create a simple task to run every 1-5 minutes:

Code:
ls -la

and watch mail logs for clues.
 
Is anacron installed on the server? On my previous server the mails didnt arrive too because anacron was missing, after yum install anacron this was resolved. If it is installed, check the mail address in the config file: /etc/anacrontab edit MAILTO to the correct value
 
Last edited:
@Vancanneyt: Yes ofcourse anacron is installed, othewise the crontabs wouldn't work and they are all working fine. The /etc/anacrontab files are also exactly the same.

@Alex: I tried when I posted my previous reply with a test cronjob in /etc/hourly and I already got several mails from that cronjob, so cron is sending out mails. It's only sa-update not sending on that 1 server.
However, I might have found the problem in the mail headers. The mail does arrive but it seems DKIM is creating troubles.
I've also seen this notice on another server:
Code:
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=server.mydomain.com; s=x; h=Date:Message-Id:Content-Type:Subject:To:From:
	Sender:Reply-To:Cc:MIME-Version:Content-Transfer-Encoding:Content-ID:
	Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
	:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
	List-Subscribe:List-Post:List-Owner:List-Archive;
	bh=/154lV/owZbAzvvpawXvtnvB1COuZNg0w1sJ3bhgzmc=; b=QpCxmNYjLydUvFowAJKOwZUMLY
	5PkkAa0Wr/RmJOY1RtCKtR9YPqD0VxCri5cHmk+CfV+Kt4gNrjU3YMjETKpr3gOCOwhtoQXQ/+MLW
	rE9Ih7SVJ7E/j6sn4CAnwMzt8KPrzOkvrK3GbBy9nGqm3ClQVwr7wao543PZEQTuCcasnVF4+L8ie
	Tbq1DoawHhXFVnBCOWF72aSaeOPESrjyEWzBK35b+fxG64VIqdXZmf6SoNJdVtF5Xw8YNe/I0y7rR
	6VOy18DDOgvPpW9TLksnDpC3ze5qpQbZOdHnyNw2v3eFvi6NJ6817ZRj60570kbIFDwrUDqMbVmCG
	XCUiYr8Q==;
Received: from root by server.mydomain.com with local (Exim 4.90)
	(envelope-from <[email protected]>)
	id 1ehLyf-0006Ll-Oi
	for [email protected]; Thu, 01 Feb 2018 22:01:01 +0100
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <root@server16> run-parts /etc/cron.hourly
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Message-Id: <[email protected]>
Date: Thu, 01 Feb 2018 22:01:01 +0100
Forward-Confirmed-ReverseDNS: Reverse and forward lookup success on 144.xxx.xxx.xxx, -10 Spam score
[b]X-DKIM: signer='server.mydomain.com' status='invalid' reason='pubkey_unavailable'[/b]
DKIMCheck: Invalid DKIM, 100 Spam score. May be a temporary problem.
SpamTally: Final spam score: 90
X-Antivirus-Scanner: Clean mail though you should still use an Antivirus

Still that's odd because DNS is working fine.

I remember this topic of me from some time ago:
http://forum.directadmin.com/showthread.php?t=54925

These servers do not use DKIM, only the email address which is alias for root is using DKIM.
I'm confused now.
 
The DKIM issue was temporarily, don't have any of these in the logs anymore.

Still, cron is not sending mail, not even from server 1 anymore from sa-update after doing a cpan upgrade and doing ./build cron.

Could this be the cause after doing a ./build cron?
Code:
Saving to: `/usr/local/directadmin/custombuild/sa-update.sh'
Because it's not saved to there in fact.

Checked the logs, it's not sending or trying to make contact at all but the cron is running perfectly every day.
Or maybe sa-update is not sending mail by default and it was just a strange thing server 1 was doing this?
 
Last edited:
Cron won't email you if a crontask did not output anything.

Man pages say:

When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists).


 
Yes, but sa-update is outputting daily, so that's why I'm wondering. Because until now on server 1 I got updates, on server 2 not.
And now server 1 is not sending either anymore after the cpan update. Cron is working fine.
Server 2 did not even send when the sa-update was full of errors.

So I'm still confused why sa-update is not sending anything on server 2 and was (before the cpan update) sending daily on server 1.
 
Run manually /etc/cron.daily/custombuild and see what it outputs.

As for /etc/cron.daily/sa-update it outputs into logs as far as I can see. And it outputs into stdout only if an error 4 happens:

Code:
[/COLOR]/usr/bin/sa-update -D --nogpg --channel sought.rules.yerp.org --channel updates.spamassassin.org > ${LOG} 2>&1

RET=$?


if [ "$RET" -ge 4 ]; then
        echo "Error updating SpamAssassin Rules. Code=$RET";
        echo "";
        cat $LOG
else
 
Aaaaah.... that explains it.

The cronjobs work but on server 1 it stated error 4 at the end.

On server 2, it was messed up totally, and it wasn't level 0 or 1 there, can't find if it even had a level to exit because it continuously gave an error, about Net::DNS if I remember correctly.
So I did the cpan update there first.

After that the sa-update also exits with level 0 or 1 now.
Since that fixed the errors I tried a cpan and Net::DNS update on server 1 too, which indeed fixed the level 4 exit.

Since both servers only exit with level 0 or 1 now daily, it explains why server 1 also stops sending the mails. So everything is working as designed.

I did expected it to mail to me if things went totally wrong because of some dependencies not working or other errors like server 2 had. Seems it doesn't.

Thank you for your help!
 
Also, when you enable this cronjob the package mailx should be installed, now it only states that you should install it (yum install mailx).

I guess that Martynas or John would require this package to be already installed when using custombuild.
 
Back
Top