OS : RedHat Linux 6.2
Shell : Bash
Our application write messages, warnings,..etc to the following log file .
/app/cms/diagnostics/logs/cms_messages.log
This file has become huge now. I want this file to be archived on monthly basis using a small shell script.
ie. On the 1st day of every month, cms_messages.log should be archived like
cms_messages_<previousMonth>_<Year>.log
Eg: On 1st June 2014, the current log file should be archived like
cms_messages_May_2014.log
and a fresh cms_messages.log should be created in the location /app/cms/diagnostics/logs ?
How can I do this ?