Have you looked at logrotate – this is probably the simplest, most widely available and well understood method of achieving this. It is highly configurable and will probably do 90% of what you need.
Have you looked at logrotate – this is probably the simplest, most widely available and well understood method of achieving this. It is highly configurable and will probably do 90% of what you need.