### Download and Verify SRPS Installer Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Download the verification script, verify its integrity, and then download and validate the main installation script using SHA256. This is the recommended installation method. ```bash # Download the verification script with cache-busting cb=$(date +%s) curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/system_resource_protection_script/main/verify.sh?cb=$cb" -o verify.sh # Verify and download install.sh with SHA256 validation bash verify.sh # Preview what will be installed (dry-run) bash install.sh --plan # Apply the full installation bash install.sh --install ``` -------------------------------- ### Install SRPS with Integrity Check Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Recommended installation method that first downloads a verification script, then uses it to securely download and verify the main installation script before applying changes. ```bash cb=$(date +%s) curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/system_resource_protection_script/main/verify.sh?cb=$cb" -o verify.sh bash verify.sh # downloads install.sh + SHA256SUMS and verifies bash install.sh --plan # dry-run bash install.sh --install # apply ``` -------------------------------- ### Homebrew Installation and Verification Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Install SRPS using Homebrew on Linux or macOS. Includes commands to verify and preview the installation. ```bash # Add the tap and install brew tap Dicklesworthstone/system_resource_protection_script https://github.com/Dicklesworthstone/system_resource_protection_script brew install srps # Verify and preview installation srps-verify latest && srps-install --plan ``` -------------------------------- ### Fast Path SRPS Installation Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md A quick installation method that pipes the install script directly to bash. Use this if you trust the source and want a faster setup. ```bash curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/system_resource_protection_script/main/install.sh?cb=$(date +%s)" | bash ``` -------------------------------- ### SRPS Installation with Custom Configuration Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Apply the SRPS installation using a specified configuration file, either a local file or one at a custom path. ```bash # Use local config file bash install.sh --config ./srps.conf --install # Use specific path bash install.sh -c /path/to/custom.conf --install ``` -------------------------------- ### SRPS Configuration File Example Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Define persistent SRPS settings by creating a configuration file, typically located at /etc/system-resource-protection.conf or a local ./srps.conf. ```bash # /etc/system-resource-protection.conf or ./srps.conf ENABLE_ANANICY=1 ENABLE_SYSCTL=1 ENABLE_WSL_LIMITS=1 ENABLE_TOOLS=1 ENABLE_SHELL_ALIASES=1 ENABLE_RULE_PULL=1 ENABLE_HTML_REPORT=1 ``` -------------------------------- ### Install SRPS via Nix/Flakes Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Installs or develops with SRPS using Nix package manager. This provides declarative and reproducible environments for SRPS tools. ```bash nix run github:Dicklesworthstone/system_resource_protection_script -- --plan nix develop github:Dicklesworthstone/system_resource_protection_script ``` -------------------------------- ### Interactive SRPS Uninstallation Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Download the installer script and run it with the --uninstall flag to interactively restore the system to its pre-SRPS state, including backup restoration. ```bash # Download and run uninstaller interactively curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/system_resource_protection_script/main/install.sh?cb=$(date +%s)" -o install.sh bash install.sh --uninstall ``` -------------------------------- ### Configure EarlyOOM Daemon Arguments Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md When enabling an OOM daemon, configure its arguments to act only when the system is effectively out of memory. This example sets arguments for earlyoom. ```bash EARLYOOM_ARGS="-r 300 -m 1 -s 1 --avoid 'systemd|sshd|Xorg|gnome-shell|kwin|plasmashell' -p" ``` -------------------------------- ### Install SRPS via Homebrew Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Installs SRPS using Homebrew. This method is suitable for users who manage their packages with Homebrew on Linux or macOS. It allows installing the latest release or tracking the main branch. ```bash brew tap Dicklesworthstone/system_resource_protection_script https://github.com/Dicklesworthstone/system_resource_protection_script brew install srps # latest tagged release # brew install --HEAD srps # track main srps-verify latest && srps-install --plan ``` -------------------------------- ### Docker Toolbox Plan Mode Execution Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Build a Docker image for SRPS tools and run it in plan mode to preview installation changes within a container. ```bash # Build the toolbox image docker build -t srps-tools . # Run in plan mode (default) docker run --rm -it srps-tools ``` -------------------------------- ### Launch sysmoni Terminal UI Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Start the interactive terminal UI system monitor. The `sys` command is available as a shorthand alias. ```bash # Launch the TUI (default) sysmoni # Use the alias sys ``` -------------------------------- ### SRPS Installer Environment Variables Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Control SRPS installer behavior and feature toggles using environment variables. Set variables to '1' to enable features and '0' to disable. ```bash # Feature toggles (1=enable, 0=disable) ENABLE_ANANICY=1 # Install and configure ananicy-cpp ENABLE_SYSCTL=1 # Apply kernel sysctl tuning ENABLE_WSL_LIMITS=1 # Configure systemd manager limits ENABLE_TOOLS=1 # Install monitoring helper tools ENABLE_SHELL_ALIASES=1 # Add shell aliases to bashrc/zshrc ENABLE_RULE_PULL=1 # Enable srps-pull-rules helper ENABLE_HTML_REPORT=1 # Enable srps-report HTML generator # Dry-run mode DRY_RUN=1 # Preview changes without applying # Custom config file path SRPS_CONFIG_FILE=/path/to/srps.conf ``` -------------------------------- ### SRPS Sysctl Tuning Values for Kernel Parameters Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Kernel parameters configured by the installer in `/etc/sysctl.d/99-system-resource-protection.conf`. These settings optimize memory, filesystem, and network behavior for interactive workloads. ```bash # Memory / writeback behavior vm.swappiness = 10 # Reduce swap aggressiveness vm.vfs_cache_pressure = 50 # Balance inode/dentry cache vm.dirty_background_ratio = 5 # Start writeback earlier vm.dirty_ratio = 10 # Limit dirty pages # Inotify limits (for IDEs / file watchers) fs.inotify.max_user_watches = 524288 # Watch more files fs.inotify.max_user_instances = 1024 # More inotify instances # Network defaults net.core.default_qdisc = fq # Fair queueing net.ipv4.tcp_congestion_control = bbr # BBR congestion control # Memory mappings (large codebases, containers) vm.max_map_count = 2147483642 # Maximum mmap regions ``` -------------------------------- ### Uninstall SRPS Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Removes SRPS and its configurations from the system. This command downloads the install script and runs it with the --uninstall --yes flags for non-interactive removal. ```bash curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/system_resource_protection_script/main/install.sh?cb=$(date +%s)" -o install.sh bash install.sh --uninstall --yes ``` -------------------------------- ### Get cursor-guard Status as JSON Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Retrieve the current status of the cursor-guard process management tool in JSON format. This is suitable for integration with monitoring scripts. ```bash SRPS_JSON=1 cursor-guard ``` -------------------------------- ### Run SRPS System Diagnostics Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Execute the srps-doctor command to check the health and configuration of your SRPS installation. It verifies sudo access, service status, and configuration files. ```bash srps-doctor ``` -------------------------------- ### Go: Create and Stream System Samples Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Instantiate a system sampler with a specified interval and stream monitoring data. The context can be used to control the sampling duration. ```go package main import ( "context" "encoding/json" "fmt" "os" "time" "github.com/Dicklesworthstone/system_resource_protection_script/internal/sampler" ) func main() { // Create sampler with 1-second interval s := sampler.New(time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() // Stream samples for sample := range s.Stream(ctx) { fmt.Printf("CPU: %.1f%%, MEM: %d/%d MB, Processes: %d\n", sample.CPU.Total, sample.Memory.UsedBytes/(1024*1024), sample.Memory.TotalBytes/(1024*1024), len(sample.Top)) // Export as JSON json.NewEncoder(os.Stdout).Encode(sample) } } ``` -------------------------------- ### Go: Access Sample Data Model Fields Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Demonstrates how to access and interpret various system metrics from a `Sample` struct, including CPU, memory, I/O, top processes, GPU, battery, and temperatures. ```go import "github.com/Dicklesworthstone/system_resource_protection_script/internal/model" // Access sample fields func processSample(s model.Sample) { // CPU metrics fmt.Printf("Total CPU: %.1f%%\n", s.CPU.Total) fmt.Printf("Load averages: %.2f %.2f %.2f\n", s.CPU.Load1, s.CPU.Load5, s.CPU.Load15) for i, core := range s.CPU.PerCore { fmt.Printf("Core %d: %.1f%%\n", i, core) } // Memory metrics fmt.Printf("Memory: %d/%d bytes (%.1f%%)\n", s.Memory.UsedBytes, s.Memory.TotalBytes, float64(s.Memory.UsedBytes)*100/float64(s.Memory.TotalBytes)) fmt.Printf("Swap: %d/%d bytes\n", s.Memory.SwapUsed, s.Memory.SwapTotal) fmt.Printf("Cached: %d, Buffers: %d\n", s.Memory.Cached, s.Memory.Buffers) // IO metrics fmt.Printf("Disk R/W: %.1f/%.1f MB/s\n", s.IO.DiskReadMBs, s.IO.DiskWriteMBs) fmt.Printf("Net RX/TX: %.1f/%.1f Mbps\n", s.IO.NetRxMbps, s.IO.NetTxMbps) // Top processes for _, p := range s.Top[:5] { fmt.Printf("PID %d (%s): CPU %.1f%%, MEM %.1f%%, FD %d\n", p.PID, p.Command, p.CPU, p.Memory, p.FDCount) } // GPU info (if available) for _, gpu := range s.GPUs { fmt.Printf("GPU %s: %.0f%% util, %.0f/%.0f MB, %.0f°C\n", gpu.Name, gpu.Util, gpu.MemUsedMB, gpu.MemTotalMB, gpu.TempC) } // Battery info if s.Battery.Percent > 0 { fmt.Printf("Battery: %.0f%% (%s)\n", s.Battery.Percent, s.Battery.State) } // Temperatures for _, t := range s.Temps { fmt.Printf("Temp %s: %.1f°C\n", t.Zone, t.Temp) } } ``` -------------------------------- ### Go: Parse Configuration from Flags or Defaults Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Configure system monitoring settings by parsing command-line flags or using default values. Options include refresh interval, sorting, filtering, output modes, and enabling specific hardware sampling. ```go import "github.com/Dicklesworthstone/system_resource_protection_script/internal/config" // Parse command-line flags cfg := config.FromFlags(os.Args[1:]) // Or use defaults cfg := config.Default() // Available options: // cfg.Interval - refresh interval (default: 1s) // cfg.Sort - sort column: "cpu" or "mem" // cfg.Filter - regex filter for process names // cfg.JSON - one-shot JSON output mode // cfg.JSONStream - streaming NDJSON mode // cfg.EnableGPU - enable GPU sampling // cfg.EnableBatt - enable battery sampling ``` -------------------------------- ### Run Make with CPU Limits Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Execute `make` commands with CPU limitations, utilizing a specified percentage of available cores. ```bash make-limited -j$(nproc) ``` -------------------------------- ### Run Node with CPU and Memory Limits Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Launch Node.js applications with both CPU and memory usage restrictions. ```bash node-limited server.js ``` -------------------------------- ### Run Cargo Builds with CPU/RAM Limits Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Use `cargo-limited` to build projects while enforcing CPU and RAM constraints. ```bash cargo-limited build --release ``` -------------------------------- ### Docker Toolbox for SRPS Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Builds a Docker image containing SRPS tools. This allows running SRPS in a containerized environment, useful for testing or isolated usage. Defaults to plan mode. ```bash docker build -t srps-tools . docker run --rm -it srps-tools # defaults to --plan # docker run --rm -it --privileged -v /:/host srps-tools --plan # risky; plan only ``` -------------------------------- ### Control IO Priority with ionice Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Adjust the disk I/O priority for processes. Use `-c3` for the idle class (lowest priority). ```bash sudo ionice -c3 -p ``` ```bash sudo ionice -c3 -p $(pgrep -f "cargo build") ``` -------------------------------- ### Run Commands with Resource Limits using systemd-run Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Utilize the 'limited' and 'limited-mem' wrappers, which leverage systemd-run, to execute commands with specific CPU or memory constraints. ```bash # Run any command with 50% CPU cap limited stress --cpu 4 --timeout 60 # Run any command with 8GB memory limit limited-mem ./memory-intensive-script ``` -------------------------------- ### Generate System Snapshot HTML Report Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Create a comprehensive HTML report of your current system state using the srps-report command. The report is saved to /tmp/srps-report.html and can be opened with a web browser. ```bash srps-report # View the report xdg-open /tmp/srps-report.html ``` -------------------------------- ### Run cursor-guard with Default or Custom Thresholds Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Automatically renice high-CPU processes and limit excessive Node.js instances. Run with default thresholds or specify custom MAX_NODE and MAX_CPU values. ```bash # Run with defaults (MAX_NODE=25, MAX_CPU=85%) cursor-guard # Custom thresholds MAX_NODE=15 MAX_CPU=70 cursor-guard ``` -------------------------------- ### Control sysmoni Process Monitoring Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Control the sysmoni process monitoring tool by setting initial sort columns, filtering processes using regular expressions, or disabling GPU/battery probing. ```bash sysmoni --sort mem sysmoni --sort cpu ``` ```bash sysmoni --filter "node|cargo" ``` ```bash sysmoni --gpu=false --battery=false SRPS_SYSMONI_GPU=0 SRPS_SYSMONI_BATT=0 sysmoni ``` -------------------------------- ### Force Kill Cursor/Node/Electron Processes Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Manually terminate runaway IDE-related processes, including Cursor, Node.js, and Electron applications. Rerun with root privileges if processes persist. ```bash # Terminate all Cursor-related processes kill-cursor ``` -------------------------------- ### sysmoni Configuration via Interval Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Customize the refresh interval for sysmoni using either command-line flags or environment variables. Seconds are assumed if no unit suffix is provided. ```bash # Set refresh interval sysmoni --interval 2s SRPS_SYSMONI_INTERVAL=2s sysmoni SRPS_SYSMONI_INTERVAL=2 sysmoni # Seconds assumed if no suffix ``` -------------------------------- ### Nix/Flakes Direct Execution and Development Shell Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Run SRPS directly using Nix flakes for a dry-run, or enter a development shell environment. ```bash # Run directly via flakes (dry-run) nix run github:Dicklesworthstone/system_resource_protection_script -- --plan # Enter development shell nix develop github:Dicklesworthstone/system_resource_protection_script ``` -------------------------------- ### sysmoni JSON Output Modes Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Export system metrics from sysmoni in JSON format. Use --json for a single snapshot, --json-stream for continuous output, or set an environment variable to log to a file. ```bash # One-shot JSON snapshot (non-interactive) sysmoni --json # Stream NDJSON until interrupted sysmoni --json-stream # Write JSON to file while running TUI SRPS_SYSMONI_JSON_FILE=/tmp/sysmoni.ndjson sysmoni ``` -------------------------------- ### SRPS Default Rules for Applications Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Pre-configured JSON rules for managing process priorities of common applications like compilers, browsers, and IDEs. These rules define 'nice' values, scheduling classes, and IO class. ```json {"name": "cargo", "nice": 19, "sched": "idle", "ioclass": "idle"} ``` ```json {"name": "rustc", "nice": 19, "sched": "idle", "ioclass": "idle"} ``` ```json {"name": "gcc", "nice": 10, "sched": "batch", "ioclass": "idle"} ``` ```json {"name": "clang", "nice": 10, "sched": "batch", "ioclass": "idle"} ``` ```json {"name": "chrome", "nice": 5, "sched": "batch", "ioclass": "best-effort"} ``` ```json {"name": "firefox", "nice": 5, "sched": "batch", "ioclass": "best-effort"} ``` ```json {"name": "cursor", "nice": 2, "sched": "other", "ioclass": "best-effort"} ``` ```json {"name": "code", "nice": 5, "sched": "other", "ioclass": "best-effort"} ``` ```json {"name": "rust-analyzer", "nice": 15, "sched": "batch", "ioclass": "best-effort"} ``` ```json {"name": "tsserver", "nice": 8, "sched": "batch", "ioclass": "best-effort"} ``` -------------------------------- ### Uninstall SRP Script Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md Use these commands to uninstall the System Resource Protection Script. The first is interactive, and the second performs a non-interactive uninstall. ```bash bash install.sh --uninstall # interactive ``` ```bash bash install.sh --uninstall --yes # non-interactive ``` -------------------------------- ### sysmoni TUI Keyboard Controls Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Reference for interactive keyboard controls within the sysmoni Text User Interface (TUI) for navigation, filtering, sorting, and toggling panels. ```bash # Navigation q, Ctrl+C, Esc # Quit (Esc clears filter/selection first) Tab, 1-3 # Switch tabs: Dashboard / Analysis / System j/k, Up/Down # Scroll process list or move selection PgUp/PgDn # Page through process list Home/End # Jump to start/end of list Enter # Show process details modal # Filtering & Sorting / # Start filter input (Enter to apply, Esc to cancel) s # Cycle sort: CPU -> MEM -> IO -> FD # Panel Toggles g # Toggle GPU panel b # Toggle Battery panel i # Toggle IO/FD panels t # Toggle Temperature panel n # Toggle Inotify panel c # Toggle Cgroups panel # Other Controls f # Freeze/unfreeze updates m # Toggle mouse support I # Show ionice tip for top process o # Toggle JSON file output ?/h # Toggle help overlay ``` -------------------------------- ### Restart Ananicy-cpp Service withSRPS-Reload-Rules Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Apply changes to Ananicy rules without needing a full system restart by using the srps-reload-rules command. It reloads the Ananicy-cpp service. ```bash srps-reload-rules ``` -------------------------------- ### Fetch Latest Ananicy Rules with SRPS-Pull-Rules Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Update your Ananicy rules to the latest version from the community repository while preserving local customizations. This command also creates a backup of existing rules. ```bash srps-pull-rules ``` -------------------------------- ### List Throttled Processes with check-throttled Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Display processes that are currently deprioritized (nice > 0) in a human-readable format. This helps identify processes that are being limited by the system. ```bash # Human-readable output check-throttled ``` -------------------------------- ### Export Throttled Process Data as JSON Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Generate a JSON output of throttled process information using the check-throttled command. This is useful for programmatic monitoring and analysis. ```bash SRPS_JSON=1 check-throttled ``` -------------------------------- ### Adjust CPU Priority with renice Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Modify the CPU scheduling priority of processes. Increasing the nice value lowers priority. ```bash sudo renice +10 -p ``` ```bash sudo renice +19 -p ``` ```bash pgrep rust-analyzer | xargs sudo renice +15 -p ``` -------------------------------- ### Run sysmoni with GPU Probing Disabled Source: https://github.com/dicklesworthstone/system_resource_protection_script/blob/main/README.md If GPU or ROCm timeouts are an issue, you can disable probing by setting the SRPS_SYSMONI_GPU environment variable to 0 before running sysmoni. ```bash SRPS_SYSMONI_GPU=0 sysmoni ``` -------------------------------- ### Ananicy Custom Process Priority Rules Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Define custom rules for Ananicy to manage process priorities. Rules specify application names, nice values, scheduling classes (`sched`), and I/O classes (`ioclass`). ```json // /etc/ananicy.d/00-default/99-custom.rules {"name": "my-heavy-app", "nice": 19, "sched": "idle", "ioclass": "idle"} {"name": "my-realtime-app", "nice": -5, "sched": "other", "ioclass": "best-effort"} {"name": "background-worker", "nice": 10, "sched": "batch", "ioclass": "idle"} ``` -------------------------------- ### Non-Interactive SRPS Uninstallation Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Perform an automated uninstallation of SRPS using the --uninstall --yes flags, suitable for scripts or CI pipelines. ```bash bash install.sh --uninstall --yes ``` -------------------------------- ### Export SRPS Diagnostics Data as JSON Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Obtain detailed system diagnostic information from srps-doctor in JSON format. This output is ideal for automated health checks and reporting. ```bash SRPS_JSON=1 srps-doctor ``` -------------------------------- ### GetSRPS-Reload-Rules Status as JSON Source: https://context7.com/dicklesworthstone/system_resource_protection_script/llms.txt Retrieve the status of the srps-reload-rules operation in JSON format, indicating whether the Ananicy-cpp service was restarted and the number of rules loaded. ```bash SRPS_JSON=1 srps-reload-rules ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.