If anyone would like to run a script on their RMM tooling, here you go, this worked for us.
Code:#!/bin/bash # Set variables TARGET_DIR="/usr/local/psa/admin/sbin" BACKUP_FILE="/root/pmm-ras_backup" TGZ_URL="https://support.cpanel.net/attachments/token/mRHWnvEh1prhjg0YITSvI3PnN/?name=pmm-ras-rhel-alma-9.x-plesk-18.0.6x.tgz" TGZ_FILE="pmm-ras-rhel-alma-9.x-plesk-18.0.6x.tgz" # Navigate to the target directory cd "$TARGET_DIR" || { echo "Failed to navigate to $TARGET_DIR. Exiting."; exit 1; } # Create a backup of the pmm-ras file if [ -f "$TARGET_DIR/pmm-ras" ]; then cp -a "$TARGET_DIR/pmm-ras" "$BACKUP_FILE" echo "Backup of pmm-ras created at $BACKUP_FILE." else echo "No pmm-ras file found to back up." fi # Remove the original pmm-ras file if [ -f "$TARGET_DIR/pmm-ras" ]; then rm -f "$TARGET_DIR/pmm-ras" echo "Original pmm-ras file removed." else echo "Original pmm-ras file does not exist. Skipping removal." fi # Download the new pmm-ras file wget -O "$TGZ_FILE" "$TGZ_URL" if [ $? -eq 0 ]; then echo "Downloaded $TGZ_FILE successfully." else echo "Failed to download $TGZ_FILE. Exiting." exit 1 fi # Extract the downloaded file tar -xvzf "$TGZ_FILE" || { echo "Extraction of $TGZ_FILE failed. Exiting."; exit 1; } echo "Extraction completed successfully." # Set permissions for the extracted file if [ -f "$TARGET_DIR/pmm-ras" ]; then chmod 755 "$TARGET_DIR/pmm-ras" chown root:root "$TARGET_DIR/pmm-ras" echo "Permissions set for pmm-ras." else echo "pmm-ras file not found after extraction. Exiting." exit 1 fi # Clean up the downloaded tar.gz file rm -f "$TGZ_FILE" echo "Cleanup: Removed $TGZ_FILE." echo "All tasks completed successfully."
Thanks for sharing this script. Could you clarify what type of RMM tool you're referring to? Are you using a specific platform (e.g., MeshCentral, NinjaOne, or similar), or do you mean tools like Ansible or Puppet for automated deployments? It would be helpful for others who want to run this script but are unsure how to integrate it with their setup.