Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 3.139.235.100
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib64/nagios/plugins/nccustom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/nagios/plugins/nccustom/check-rpmdb-integrity.sh
#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

## check-rpmdb-integrity
## Created by Ihor Bilyi
##       Namecheap

##  This NRPE check "RPM Database Integrity" check the integrity of the RPM database packages file on shared hosting servers.


## Nagios Status
## 0 = OK (RPM database OK)
## 2 = CRITICAL (RPM database is corrupted)
## 3 = UNKNOWN (Max attempts reached)


##input option
PROGNAME=${0##*/}

print_usage() {
    echo ""
    echo "Usage: $PROGNAME  --help"
}

print_help() {
    print_usage
    echo ""
    echo "This check controls the integrity of the RPM database packages file on shared hosting servers (see TOP-1102)"
    echo ""
    echo "--help Print this help screen"
    echo ""
    exit 3
}

rpmdbcheck () {
    timeout -s 9 10m repoquery --quiet --installed -a > /dev/null
    resrc=$?
}

while [ $# -gt 0 ]; do

    case "$1" in
        --help)
        print_help
         ;;

        -h)
        print_help
         ;;

        *)
        echo >&2 "Unknown argument: $1"
        print_usage
        exit 3
        ;;

        esac
        shift
done
# Initialize attempt counter
attempt=0
max_attempts=10
dnf_lockfile='/var/cache/dnf/metadata_lock.pid'

while (( attempt < max_attempts )); do
    if [ -f $dnf_lockfile ]; then
        dnf_pid=$(grep -E -m 1 '^[0-9]*$' $dnf_lockfile)
        if [ -n "$dnf_pid" ]; then         
            if kill -0 "$dnf_pid" 2>/dev/null; then
                echo "Detected dnf lock file with PID $dnf_pid"
                sleep 10
                ((attempt++))
            else
                rpmdbcheck
                break
            fi
        else
            rpmdbcheck
            break
        fi
    else
        rpmdbcheck
        break
    fi
done

if (( attempt >= max_attempts )); then
    echo "UNKNOWN (Max attempts reached)"
    exit 3
fi

if  [[ $resrc -eq 0 ]] ; then
    echo "OK (RPM database OK)"
    exit 0
else
    echo "CRITICAL (RPM database is corrupted)"
    exit 2
fi

Youez - 2016 - github.com/yon3zu
LinuXploit