| Server IP : 192.250.235.158 / Your IP : 216.73.216.4 Web Server : LiteSpeed System : Linux s4099.sgp1.stableserver.net 5.14.0-503.21.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Jan 12 09:45:05 EST 2025 x86_64 User : vmxfzbqj ( 1905) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
#
# Compare installed and latest version of Softaculous
# Fetch latest version
_latest_version=$(curl --silent "https://api.softaculous.com/updates.php?version=latest&panel=cpanel&in=json" | jq -r '.version' 2>/dev/null)
# Fetch installed version
_installed_version=$(/usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/whostmgr/docroot/cgi/softaculous/cli.php --version 2>/dev/null)
_main(){
# Check if Softy is installed
if [[ ! -d "/usr/local/cpanel/whostmgr/docroot/cgi/softaculous" ]]; then
echo "Softaculous is not installed!"
exit 2
fi
# Compare versions using awk to handle decimal numbers
if awk -v latest="${_latest_version}" -v installed="${_installed_version}" 'BEGIN{if (installed < latest) exit 0; exit 1}'; then
echo "Softaculous version is outdated: ${_installed_version} (latest version is: ${_latest_version})"
exit 2
else
echo "Softaculous version is updated: ${_installed_version}"
exit 0
fi
# Save installed version and timestamp to the separate version cache
echo "${_installed_version} $(date +%s)" > "${_version_cache}"
}
_main