I have some problems with nginx log rotation - nginx -s reopen
does not reopen the log file, this is why I am researching the topic.
In several places, I found this script:
$ mv access.log access.log.0
$ kill -USR1 `cat master.nginx.pid`
$ sleep 1
$ gzip access.log.0 # do something with access.log.0
My question is why there is sleep after kill? It seems unnecessary, because even reopen slows, gzip will not be able to compress everything for 1 second anyway?
Do they do it this way in case file is very small, so no data to be lost?