Question: Linux Question 1. There has been suspicious activity on the system. In order to preserve log information, it will be necessary to archive the current
Linux
Question 1.
There has been suspicious activity on the system. In order to preserve log information, it will be necessary to archive the current files in /var/log ending with the .log extension. The files are to be saved to a file named log.tar, stored in the directory, ~/archive. Eg. If today is 27 March 2020, the tile name should be log20200327.tar (YYYYMMDD format).
It has also been requested that the files that were archived be saved to a directory, ~/backup . Files archived there should only be only root readable and cannot be modified or deleted or renamed and soft or hard linked.
The bash script should be run daily and should ideally be automated and display on screen and/or mail a summary of the output to the script owner. Ideally the bash script will be able to do file management and ensure files older than 30 days are deleted.
Requirements
Produce a menu driven and/or argument accepting script which can do the following
a) Create an archive named log.tar that is stored in the archive directory located in the home directory with appropriate permissions.
b) Remove path names from the files that are archived.
c) Produce verbose output while archiving.
d) List the contents of the archive without extracting.
e) Extract the files to the directory, ~/backup.
f) Clean up files older than 30 days.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
