TOMODACHI SHELL
Free Palestine !! - Free Gaza !!
Current File : //usr/src/../../opt/managed_servers/scripts/cp_license.sh |
readonly CPLICENSE_CHECK_DATA="${BACKGROUND_DATA}/cplicense_check.data";
readonly CPLICENSE_CHECK_ERRORS="${BACKGROUND_DATA}/cplicense_check.errors";
cp_license_check_main(){
declare -A cplicense_data;
local cplicense_initial_status="$(/usr/local/nagios/plugins/check_cplicense)";
local disabled="not configured";
local inactive="service is down";
local active="OK: cPanel license is active";
if [[ "$cplicense_initial_status" =~ "$active" ]]; then
cplicense_data[service_status]="$SERVICE_ACTIVE";
else
local cp_restart_res="$(/scripts/restartsrv_cpsrvd 1>/dev/null 2>&1; /scripts/restartsrv_cpsrvd --status)";
local cp_license_update_res="$(/usr/local/cpanel/cpkeyclt 2>&1)";
local cp_license_updated="Updating cPanel license...Done. Update succeeded.";
if [[ "$cp_license_update_res" =~ "$cp_license_updated" ]]; then
cplicense_data[service_status]="$SERVICE_ACTIVE";
cplicense_data[auto_fix_status]="$AUTO_FIX_SUCCESS";
else
cplicense_data[service_status]="$SERVICE_DOWN";
cplicense_data[auto_fix_status]="$AUTO_FIX_FAIL";
fi;
fi;
bash_arr_to_json cplicense_data "${!cplicense_data[@]}" > "$CPLICENSE_CHECK_DATA";
}
cp_license_check(){
run_check_in_background "cp_license_check_main" "$CPLICENSE_CHECK_DATA" "$CPLICENSE_CHECK_ERRORS"\
"${CHECK_LOCKS_DIR}/${FUNCNAME}.lock";
}
TOMODACHI | Tempest Hacker