| Server IP : 198.38.94.67 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/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