IO Proc Monitorization

IO Proc Monitorization shell script

Link: GitHub
Module: Operating Systems
Graduation Year: 2
This bash script is designed to analyze and manipulate information about processes on a Linux system. It provides a comprehensive set of functionalities to gather, process, and present data related to running processes.

The script comprises several functions, each serving a specific purpose in the process analysis workflow. These functions include displaying help information, retrieving process data from the /proc directory, validating input arguments, performing pre-checks on process files, handling default sorting of process data, extracting I/O information from processes, and filtering, sorting, and printing process data based on user-specified criteria.

In the main script section, the process analysis workflow unfolds step by step. It begins with setting up a trap to ensure proper cleanup of temporary files if the script execution is interrupted. The script then proceeds to gather process information before and after a specified delay, ensuring the existence of processes, and creating a file containing processed process data.

Using the getopts functionality, the script parses command-line options provided by the user to customize the analysis. Users can specify various criteria such as regular expressions, user names, date ranges, and sorting options. Based on these options, the script filters, sorts, and manipulates process data accordingly. Finally, the processed process data is presented to the user, offering insights into the system's running processes.

This script serves as a valuable tool for system administrators, developers, or anyone interested in gaining deeper insights into process activity on a Linux system. Its flexibility and customization options make it suitable for a wide range of use cases, from troubleshooting system performance issues to monitoring process behavior over time.

IO Proc Monitorization