- System protection script with custom enhancements and TUI interface - Browser tab limiting and application-specific monitoring - AI behavior learning and predictive analysis - Terminal-based configuration interface - Multi-distro installation support
PC Anti-Freeze Monitor
System protection script with custom enhancements and TUI interface.
Overview
A comprehensive system monitoring solution designed to prevent PC crashes and freezes through aggressive resource management and intelligent process control.
Features
🛡️ Core Protection
- CPU Monitoring: Automatic process termination when CPU usage exceeds thresholds
- Memory Management: Prevents system freezes by managing RAM usage
- Temperature Control: Protects against thermal damage with smart cooling
- Disk Space Management: Automatic cleanup when storage is low
🚀 Advanced Features
- Browser Tab Limiting: Controls Firefox, Chrome, and Edge tab counts
- Application-Specific Thresholds: Custom settings for games, IDEs, browsers
- AI Behavior Learning: Adapts to process patterns over time
- Predictive Analysis: Early warnings before resource limits
- Network & I/O Monitoring: Tracks bandwidth and disk usage
- Smart Process Prioritization: Rewards well-behaved applications
🎛️ Control Interface
- Terminal User Interface (TUI): Full-featured configuration interface
- Real-time Monitoring: Live system status and resource tracking
- Service Management: Start, stop, restart, and configure auto-start
- Configuration Management: Export, import, and reset settings
Installation
Quick Install
sudo ./install.sh
Manual Installation
-
Install dependencies:
# Arch Linux sudo pacman -S bc psmisc lm_sensors procps-ng coreutils # Ubuntu/Debian sudo apt install bc psmisc lm-sensors procps coreutils -
Run installation script:
sudo ./install.sh
Usage
TUI Control Interface
# Launch terminal interface
pc-monitor-tui
Service Management
# Check status
systemctl status pc-monitor
# View live logs
journalctl -u pc-monitor -f
# Restart service
sudo systemctl restart pc-monitor
Manual Execution
# Run in foreground (testing)
sudo ./pc-monitor.sh
# Run in background
sudo nohup ./pc-monitor.sh &
Configuration
Edit /etc/pc-monitor.conf or use the TUI interface:
Basic Thresholds
- CPU_THRESHOLD: CPU usage limit (default: 85%)
- MEMORY_THRESHOLD: RAM usage limit (default: 90%)
- TEMP_THRESHOLD: Temperature limit (default: 80°C)
- DISK_THRESHOLD: Disk usage limit (default: 95%)
Browser Control
- FIREFOX_MAX_TABS: Maximum Firefox tabs (default: 15)
- CHROME_MAX_TABS: Maximum Chrome processes (default: 15)
- AGGRESSIVE_ON_BROWSERS: Enable aggressive browser monitoring
Application-Specific
- GAME_CPU_THRESHOLD: CPU limit for games (default: 95%)
- IDE_MEMORY_THRESHOLD: Memory limit for IDEs (default: 75%)
System Requirements
- OS: Linux (tested on Arch, Ubuntu, RHEL, Fedora)
- Kernel: 4.0+
- RAM: 512MB minimum
- Dependencies: bc, psmisc, lm_sensors, procps, coreutils
- Permissions: Root access required
How It Works
Monitoring Cycle (5-second intervals)
- CPU Check: Kills high-CPU processes when system load exceeds threshold
- Memory Check: Terminates memory-heavy processes during RAM pressure
- Temperature Check: Reduces CPU load when temperature is too high
- Browser Control: Enforces tab limits and process counts
- Predictive Analysis: Warns about trending resource usage
- Behavior Learning: Adapts thresholds based on process history
Intelligent Features
- Application Classification: Automatically categorizes running processes
- Adaptive Thresholds: Learns from process behavior over time
- Smart Targeting: Prioritizes problematic processes for termination
- Graceful Degradation: Continues monitoring even if some features fail
Files Structure
pc-control-anti-freeze/
├── pc-monitor.sh # Main monitoring script
├── pc-monitor-tui.sh # Terminal user interface
├── install.sh # Installation script
├── pc-monitor.service # Systemd service file
├── test-enhanced-features.sh # Feature testing
├── verify-enhancements.sh # Enhancement verification
└── demo-tui.sh # TUI demonstration
Logs and Monitoring
Log Files
- Service logs:
journalctl -u pc-monitor -f - Monitor logs:
/var/log/pc-monitor.log - Behavior database:
/var/log/pc-monitor-behavior.db - Trend analysis:
/var/log/pc-monitor-trends.log
Log Rotation
Automatic log rotation configured for 7-day retention with compression.
Troubleshooting
Service Issues
# Check service status
systemctl status pc-monitor
# View detailed logs
journalctl -u pc-monitor --no-pager
# Restart if needed
sudo systemctl restart pc-monitor
Permission Issues
# Ensure proper ownership
sudo chown root:root /usr/local/bin/pc-monitor
sudo chmod +x /usr/local/bin/pc-monitor
Missing Dependencies
# Verify required commands
for cmd in bc ps free df top sensors; do
command -v "$cmd" >/dev/null && echo "✓ $cmd" || echo "✗ $cmd missing"
done
Safety Features
- Process validation: Verifies processes exist before termination
- Smart targeting: Avoids killing critical system processes
- Graceful handling: Continues monitoring if individual checks fail
- Comprehensive logging: All actions logged for audit trails
Performance Impact
- CPU Usage: <1% under normal conditions
- Memory Usage: ~2-5MB RAM
- Disk I/O: Minimal logging overhead
- Network: No network usage
Uninstallation
sudo ./install.sh uninstall
This removes all files, stops the service, and cleans up configuration.
License
This project is provided as-is for system protection purposes. Use responsibly and test thoroughly in your environment.
⚠️ Warning: This script aggressively terminates processes to prevent system crashes. Test thoroughly and adjust thresholds according to your usage patterns.
Description
Languages
Shell
72.6%
Python
27.4%