rails log rotation

2009 November 12
by robertor

No need to restart by following this post:
http://www.hostingrails.com/401/What-is-the-best-practice-for-rails-log-rotation-How-to-use-logrotate

#!/bin/sh
mkdir /mnt/app/releases/mysite.com/log/archive -p
tar czf "/mnt/app/releases/mysite.com/log/archive/`date +%Y%m%d`_production.tar.gz" -C / mnt/app/releases/mysite.com/log/production.log
cat /dev/null > /mnt/app/releases/mysite.com/log/production.log
find /mnt/app/releases/mysite.com/log/archive/* -mtime +180 -exec rm {} \;

No comments yet

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS