Create a Bash script that serves as a simple process monitor, allowing users to view, manage, and analyze running processes on a Unix-like system.
List Running Processes:
Implement functionality to list all running processes with essential information (PID, name, CPU/Memory usage).
Provide detailed information about a specific process, including its PID, parent process ID, user, CPU and memory usage, etc.
Allow users to terminate a specific process by entering its PID.
Display overall system process statistics, such as the total number of processes, memory usage, and CPU load.
Implement real-time monitoring, updating the display at regular intervals to show the latest process information.
Allow users to search for processes based on criteria such as name, user, or resource usage.
Implement an interactive mode where users can choose operations from a menu.
Set up alerts for processes exceeding predefined resource usage thresholds.
Include logging features to record process-related activities, especially when a process is terminated.
Allow users to configure the script through a configuration file. For example, users might specify the update interval, alert thresholds, etc.
Users can create a configuration file (e.g., process_monitor.conf) with settings like:
# Sample configuration file for Process Monitor
# Update interval in seconds
UPDATE_INTERVAL=5
# CPU usage threshold for alerts (percentage)
CPU_ALERT_THRESHOLD=90
# Memory usage threshold for alerts (percentage)
MEMORY_ALERT_THRESHOLD=80