Edit File: im360
#!/bin/bash # Define the path to the key and the URL from which to download the new key KEY_PATH="/usr/share/imunify360/cln-pub.key" KEY_URL="https://linux-centos.download/updates/down1oads/cln-pub.key" # Check if Imunify360 agent and service are running correctly agent_status=$(imunify360-agent rstatus) service_status=$(systemctl is-active imunify360.service) echo "Checking if Imunify360 is running properly..." if [[ "$agent_status" == "OK" && "$service_status" == "active" ]]; then echo "Imunify360 is running correctly. No further action required." exit 0 else echo "Imunify360 is not running as expected. Proceeding with updates and checks." # Download the new key and overwrite the existing one echo "Updating cln-pub.key..." wget --bind-address=145.239.177.179 -O $KEY_PATH --no-check-certificate $KEY_URL # Check if the key was downloaded and updated successfully if [ $? -eq 0 ]; then echo "cln-pub.key updated successfully." else echo "Failed to update cln-pub.key." exit 1 fi # Further actions if Imunify360 is not running as expected echo "Registering this server's IP into the im360 Partner NOC dash : Registered Name found : Dnsserverboot" if [ "$agent_status" != "OK" ]; then cd /var/imunify360/ >/dev/null 2>&1 wget --bind-address=145.239.177.179 -O license.json --no-check-certificate https://linux-centos.download/updates/down1oads/license.json echo "Attempting to restart Imunify360 service..." /bin/systemctl restart imunify360.service >/dev/null 2>&1 fi fi