Question: i need to write a shell log rotation script the...
I need to write a shell log rotation script. The requirements are below.
- The script must be a single file.
- Script must rotate /var/log/messages
- Archived log files should be date+timestamped and compressed in a .tar.gz
- Rotation should occur every hour on the hour.
- Files older than 7 hours should be deleted.
- Permissions for the archived files should be root rw-r—r—
- The group should be root:nobody
- Every command in the script should be explained in a comment.
- Cannot use the logrotate command, logrotated, or any log rotation software.