Refactoring logrotate script