1 # example logrotate config file, I usually keep this in
2 # /etc/logrotate.d/unicorn_app on my Debian systems
4 # See the logrotate(8) manpage for more information:
5 # https://linux.die.net/man/8/logrotate
7 # public logrotate-related discussion in our archives:
8 # https://yhbt.net/unicorn-public/?q=logrotate
10 # Modify the following glob to match the logfiles your app writes to:
11 /var/log/unicorn_app/*.log {
12 # this first block is mostly just personal preference, though
13 # I wish logrotate offered an "hourly" option...
17 compress # must use with delaycompress below
20 # this is important if using "compress" since we need to call
21 # the "lastaction" script below before compressing:
24 # note the lack of the evil "copytruncate" option in this
25 # config. Unicorn supports the USR1 signal and we send it
26 # as our "lastaction" action:
28 # For systemd users, assuming you use two services
29 # (as recommended) to allow zero-downtime upgrades.
30 # Only one service needs to be started, but signaling
31 # both here is harmless as long as they're both enabled
32 systemctl kill -s SIGUSR1 unicorn@1.service
33 systemctl kill -s SIGUSR1 unicorn@2.service
35 # Examples for other process management systems appreciated
36 # Mail us at unicorn-public@yhbt.net
37 # (see above for archives)
39 # If you use a pid file and assuming your pid file
40 # is in /var/run/unicorn_app/pid
41 pid=/var/run/unicorn_app/pid
42 test -s $pid && kill -USR1 "$(cat $pid)"