Linux Training : 2. Linux basics test

This is where you get to put all the knowledge you've accumulated through the entire Linux Basics section into play.

What is needed is a script that will collect some system information on a daily schedule and write that data to a file.
The script should be packaged into an rpm file and installed with the rpm commands. It should automatically setup the scheduling to be run at 2:05 am Monday - Friday. The output file should be /tmp/status_check. The rpm should be named GTRI-status-test with appropriate version numbers. A template src.rpm is provided. Each of the output requirements below should be added as a patch to the original GTRI-status-test package (a total of 7 patches).

The data to be collected is

  • name and shell of all users with UID 0
  • User name and number of logins yesterday
  • How long has the system been running?
  • What is the memory usage at the time this script runs and the date and time it runs.
  • rpm info of the Status-test rpm including the md5 signature of the package
  • The size of the output file and its SELinux context
  • A copy of the script that produces this report.

A template src.rpm is here

Output format should be as follows:

Report name

hostname

Report date

Report time

Memory usage

System run time

output file name

size of file in bytes

SELinux context

 

__________________________
rpm info
__________________________
UID 0 and shell data
__________________________
User login count data
__________________________

copy of script

__________________________

Concepts of this exercise

The goal is to work through a simulated project that has most of the ideas presented in the beginning training process. The initial script is bash. But if another scripting language is preferred, use it as long as the patching process is preserved. Of course, the main bash script can call external scripts in other languages easily.
The output formatting is very loosely defined. The idea is to present the data for a human reader. XML is probably not a good idea here.
At the end of the rpm build process, the plan is to install the final rpm on another system and run it.
Additionally, the src.rpm will be evaluated to see how the patch process was used.

Attachments:

Status-test-0.0.1-1.src.rpm (application/x-rpm)