unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob 77a01b5ea915204c7d382255699236c729c40ed7 1534 bytes (raw)
$ git show gperf:examples/logrotate.conf	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
# example logrotate config file, I usually keep this in
# /etc/logrotate.d/unicorn_app on my Debian systems
#
# See the logrotate(8) manpage for more information:
#    https://linux.die.net/man/8/logrotate
#
# public logrotate-related discussion in our archives:
#    https://bogomips.org/unicorn-public/?q=logrotate

# Modify the following glob to match the logfiles your app writes to:
/var/log/unicorn_app/*.log {
	# this first block is mostly just personal preference, though
	# I wish logrotate offered an "hourly" option...
	daily
	missingok
	rotate 180
	compress # must use with delaycompress below
	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
		# For systemd users, assuming you use two services
		# (as recommended) to allow zero-downtime upgrades.
		# Only one service needs to be started, but signaling
		# both here is harmless as long as they're both enabled
		systemctl kill -s SIGUSR1 unicorn@1.service
		systemctl kill -s SIGUSR1 unicorn@2.service

		# Examples for other process management systems appreciated
		# Mail us at unicorn-public@bogomips.org
		# (see above for archives)

		# If you use a pid file and assuming your pid file
		# is in /var/run/unicorn_app/pid
		pid=/var/run/unicorn_app/pid
		test -s $pid && kill -USR1 "$(cat $pid)"
	endscript
}

git clone https://yhbt.net/unicorn.git