6

I have a configuration file that looks like:

/var/log/nginx/*.log {
        daily
        missingok
        rotate 90
        dateext
        compress
        notifempty
        create 644 root adm
        sharedscripts
        postrotate
                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
                /usr/local/bin/synclogs.sh
        endscript }

synclogs.sh is supposed to run when all the log files have been rotated and compressed. The script does kick off successfully, but when it starts running, the program doesn't find any of the .gz files that logrotate was supposed to make. I ran the script manually a few minutes later, it kicks off fine.

According to docs I found, postrotate isn't supposed to kick off until compression has finished. Is that not the case? Is this a bug in the logrotate that ships in Debian Squeeze or did I just miss something very simple?

Will
  • 826
  • 2
  • 9
  • 19

2 Answers2

1

Have you tried this:

/var/log/nginx/*.log {
        daily
        missingok
        rotate 90
        dateext
        compress
        **delaycompress**
        notifempty
        create 644 root adm
        sharedscripts
        postrotate
                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
                /usr/local/bin/synclogs.sh
        endscript }

Take a look at the delaycompress option, of course without "*" HTH

sebelk
  • 682
  • 4
  • 13
  • 32
  • Yeah, I'm looking to upload the compressed versions though and didn't want to compress them manually – Will Jul 28 '12 at 16:32
1

In case anybody is wondering, compress fires off AFTER postrotate, despite what the man page says.

Will
  • 826
  • 2
  • 9
  • 19