Skip to content

Instantly share code, notes, and snippets.

@ranguard
Created October 3, 2011 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranguard/5fd3c323a6bf2262945d to your computer and use it in GitHub Desktop.
Save ranguard/5fd3c323a6bf2262945d to your computer and use it in GitHub Desktop.
/var/log/psgi/foxtons-website/*.log {
daily
rotate 52
missingok
delaycompress
notifempty
create 640 web web
sharedscripts
postrotate
LOGDIR="/var/log/psgi/foxtons-website"
if [ -f /tmp/starman_foxtons-website.pid ]; then \
if [ -x /usr/sbin/invoke-rc.d ]; then \
invoke-rc.d starman_foxtons-website restart > /dev/null 2>&1; \
else \
/etc/init.d/starman_foxtons-website restart > /dev/null 2>&1; \
fi; \
fi;
HOSTNAME=`/bin/hostname`
EXT=`/bin/date -d yesterday +%F`
for f in access.log error.log;
do
if [ -f $LOGDIR/$f.1 ]; then
mv $LOGDIR/$f.1 $LOGDIR/$f-foxtons-website.$HOSTNAME.$EXT;
/usr/bin/nice -20 /bin/bzip2 -f $LOGDIR/$f-foxtons-website.$HOSTNAME.$EXT
chown web.web $LOGDIR/$f-foxtons-website.$HOSTNAME.$EXT.bz2
chmod 666 $LOGDIR/$f-foxtons-website.$HOSTNAME.$EXT.bz2
fi;
done
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment