1

Recently I have removed nginx on my server running Debian Linux and since then, I keep getting the following email every day:

root@server:~# tail /var/mail/root
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/nginx/*.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

In some cases it helps to remove software with dpkg --purge but in this case the config files seems to be placed in some other place which won't be removed by dpkg. I've also walked through every config file of logrotate that I could find but I can't find anything regarding nginx.

So here is my /etc/cron.daily/logrotate (nothing special):

#!/bin/sh

test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf

And here is my /etc/logrotate.conf (I think nginx should be listed here?):

# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
 missingok
 monthly
 create 0664 root utmp
 rotate 1
}

/var/log/btmp {
 missingok
 monthly
 create 0660 root utmp
 rotate 1
}

# system-specific logs may be configured here

And also the linked directory /etc/logrotate.d:

root@server:~# ls -la /etc/logrotate.d
total 40
drwxr-xr-x  2 root root 4096 Apr 19 00:33 .
drwxr-xr-x 76 root root 4096 Mai 28 14:44 ..
-rw-r--r--  1 root root  326 Mär  4  2013 apache2
-rw-r--r--  1 root root  173 Nov 16  2013 apt
-rw-r--r--  1 root root   79 Nov  7  2012 aptitude
-rw-r--r--  1 root root  232 Okt  1  2013 dpkg
-rw-r--r--  1 root root  880 Jan 20 16:36 mysql-server
-rw-r--r--  1 root root  163 Feb 17 10:32 php5-fpm
-rw-r--r--  1 root root  799 Sep 28  2013 proftpd-basic
-rw-r--r--  1 root root  515 Mär  5  2013 rsyslog

So where is the config file for nginx? I think removing such a config file would solve my problem?

2
  • Try "grep nginx /etc/logrotate.d/*" It's not out of the question that one of those other files has some reference to nginx, for some bizzarro reason Dec 29, 2014 at 8:36
  • did you ever resolve this? I just got this message too (though just once)
    – codeling
    May 31, 2015 at 18:13

0

You must log in to answer this question.

Browse other questions tagged .