• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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