Question: 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
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-rr
- 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
