Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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

share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.