RunCommandsInHighRamUsage
Overview
RunCommandsInHighRamUsage is a Bukkit/Spigot plugin designed to monitor your server's RAM usage and execute custom commands when the RAM usage exceeds a specified limit. This helps in managing high RAM usage by executing predefined commands to control or mitigate the impact on the server's performance.
Features
- Monitor RAM Usage: Periodically checks the server's RAM usage.
- Execute Commands: Executes a list of custom commands when the RAM usage exceeds the defined limit.
- Lower RAM Limit: Optionally re-execute commands only when the RAM usage drops below a configurable lower limit.
- Logging: Logs RAM usage at specified intervals.
- Player Notifications: Notifies players with a custom message when the RAM limit is exceeded.
- Command Management: Add, remove, and list commands dynamically via in-game commands.
- Execution Mode: Execute commands only once until the server restarts, or execute once until RAM usage drops below the lower limit.
Configuration
# RunCommandsInHighRamUsage Configuration
# Define the RAM limit at which the commands will be executed.
# Use the suffix 'MB' for megabytes or 'GB' for gigabytes.
# Example: '27GB' or '27000MB'
ram-limit: '27GB'
# Define the lower RAM limit at which the execution flag will be reset, allowing commands to be executed again when the RAM limit is exceeded.
# Use the suffix 'MB' for megabytes or 'GB' for gigabytes.
# Example: '15GB' or '15000MB'
lower-ram-limit: '15GB'
# List of commands to be executed when the RAM limit is exceeded.
commands:
- chunky pause
# - restartServer
# - lagg clear
# Logging settings
logging:
# Enable/disable RAM usage logging.
enabled: true
# Logging interval in seconds.
interval: 60
# Player notification settings
notify-players:
# Enable/disable player notifications.
enabled: true
# Notification message color.
color: 'YELLOW' # Valid colors: BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE
# Execution settings
# Enable/disable executing commands only once until the lower RAM limit is reached.
# If disabled, commands will only be executed once until the server is restarted.
execute-once: true
Commands
/toggleRunCommands: Enable or disable the RunCommandsInHighRamUsage plugin.
/addCommand <command>: Add a command to the list of commands to execute when the RAM limit is exceeded.
/removeCommand <command>: Remove a command from the list of commands to execute when the RAM limit is exceeded.
/listCommands: List all commands in the list.
Installation
- Download the
.jar plugin file from the CurseForge page.
- Place the
.jar file in your server's plugins directory.
- Start your server to generate the default configuration file.
- Edit the configuration file (
config.yml) to set your desired RAM limits and commands.
- Restart your server to apply the changes.
Usage
Once the plugin is installed and configured, it will automatically monitor your server's RAM usage and execute the specified commands when the RAM usage exceeds the defined limit. Use in-game commands to dynamically manage the list of commands.