-
Notifications
You must be signed in to change notification settings - Fork 1
Logrotating
Anton Gushcha edited this page Apr 18, 2014
·
1 revision
It is possible to use pgator with logrotate utility. When pgator is started in daemon mode, there is two parameters by default:
--pidfile=/var/run/pgator.pid
--lockfile=/var/run/pgator.lock
In pidfile
daemon puts it PID and lockfile
could be used to check if daemon is running. For instance, extracting pid from .pid file:
[ ! -f /var/run/pgator/pgator.pid ] || echo `cat /var/run/pgator/pgator.pid`
Daemon listens SIGMINRT+10
signal for logrotating:
kill -s SIGMINRT+10 <pid>
So, example logrotate config:
/home/dw/debianworld.ru/logs/nginx_*.log {
daily # daily rotation
missingok # missing file isn't an error
rotate 45 # save history for 45 days
compress # compress rotating files
delaycompress # current file isn't compressed
notifempty # don't process empty files
create 640 dw www-data # privileges and user of new file
sharedscripts # prerotate/postrotate are executed only once
postrotate # reload pgator log
[ ! -f /var/run/pgator/pgator.pid ] || kill -s SIGMINRT+10 `cat /var/run/pgator/pgator.pid`
endscript
}