Skip to content

Instantly share code, notes, and snippets.

@pshima
Created December 15, 2011 07:03
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save pshima/1480137 to your computer and use it in GitHub Desktop.
Save pshima/1480137 to your computer and use it in GitHub Desktop.
Unicorn logrotate
/path/to/unicorn/log/unicorn.stderr.log
/path/to/production/log/production.log
{
daily
missingok
rotate 180
compress
dateext
# this is important if using "compress" since we need to call
# the "lastaction" script below before compressing:
delaycompress
# note the lack of the evil "copytruncate" option in this
# config. Unicorn supports the USR1 signal and we send it
# as our "lastaction" action:
lastaction
pid=/path/to/pid/unicorn.pid
test -s $pid && kill -USR1 "$(cat $pid)"
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment