• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Nginx cron email

PolitisP

New Pleskian
Hello,
As far as I know plesk 11 supports nginx, so I decided to install this component. I installed it from plesk, started it and it seems to work ok, although I receive everyday the following email:

Subject: Cron <root@server> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Message:
/etc/cron.daily/logrotate:
Reopen NGINX log files: .


Starting from today, gmail bounces these emails, considering them as spam. Is there any way to stop receiving this email and only receive email for nginx in case of a problem?


Installed Plesk version/build: 11.0.9 Debian 6.0
Arch: x86_64
 
Last edited:
please follow the provided instructions:

#cat /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

To disable email notification you can set MAILTO="" variable at the start of your logrotate file:

- Edit/open logrotate
#vi /etc/cron.daily/logrotate
- At the top of the file, enter:
MAILTO=""
- Save and close the file.

You can try to start logrotate manually and see what you got:
# /bin/sh /etc/cron.daily/logrotate
 
Can you give more details of this solution? Adding MAILTO="" to the top of logrotate isn't working for me. Or at least, when I test as directed I don't get the email update, but I still get one every night.

please follow the provided instructions:

#cat /etc/cron.daily/logrotate
#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0

To disable email notification you can set MAILTO="" variable at the start of your logrotate file:

- Edit/open logrotate
#vi /etc/cron.daily/logrotate
- At the top of the file, enter:
MAILTO=""
- Save and close the file.

You can try to start logrotate manually and see what you got:
# /bin/sh /etc/cron.daily/logrotate
 
I was trying to find a solution for it today again. So you are a bit lucky. What I tried is the following:

File: /etc/logrotate.d/nginx

I changed: /etc/init.d/nginx reopen || true
to: /etc/init.d/nginx reopen > /dev/null || true

I'm not sure if it'll work, I'll wait till tomorrow to see, but you may want to try this instead, since i bet you'll have higher chance of success:
Change: /etc/init.d/nginx reopen || true
to: /etc/init.d/nginx reopen > /dev/null 2>/dev/null || true
 
Thanks for that PolitisP. Let me know how you get on tomorrow, and I'll do the same.

I was trying to find a solution for it today again. So you are a bit lucky. What I tried is the following:

File: /etc/logrotate.d/nginx

I changed: /etc/init.d/nginx reopen || true
to: /etc/init.d/nginx reopen > /dev/null || true

I'm not sure if it'll work, I'll wait till tomorrow to see, but you may want to try this instead, since i bet you'll have higher chance of success:
Change: /etc/init.d/nginx reopen || true
to: /etc/init.d/nginx reopen > /dev/null 2>/dev/null || true
 
Back
Top