ROOTPLOIT
Server: Apache
System: Linux node6122.myfcloud.com 6.14.3-x86_64-linode168 #1 SMP PREEMPT_DYNAMIC Mon Apr 21 19:47:55 EDT 2025 x86_64
User: bashacomputer (1004)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/nagios/plugins/check_a2_omni_mysql_backup.sh
#!/bin/bash
#
# mysql_backup_check.sh a bash script that checks if the backup of databases defined in $MONITORED_DB were successful
# it monitors mysql backups that are created by /opt/bin/mysql_backup.sh script
# REF: SYSENG-23785
# author: mfranczak@a2hosting.com

# Comma separated list of the backups of databases we want to monitor.
MONITORED_DB="omni,supersekrit,mysql,information_schema"
# Backup location
BACKUP_LOCATION="/opt/backup/"
FAILED_BCKP=''

# Set the Internal Field Separator (IFS) to a comma
IFS=','
# Convert the variable into an array
read -ra DBS <<< "$MONITORED_DB"

# Loop through the array of monitored DBs  and echo each value separately
for DB in "${DBS[@]}"; do
  ERROR=$(find "${BACKUP_LOCATION}" -type f -name ".backup_failed_${DB}" | wc -l)
  # Alert if backup number is 0
  if [ "${ERROR}" != "0" ]; then
    if [ -z "${FAILED_BCKP}" ]; then
      FAILED_BCKP="${DB}"
    else
      FAILED_BCKP="${FAILED_BCKP}, ${DB}"
    fi
  fi
done

if [ -z "${FAILED_BCKP}" ]; then
  echo "check_a2_omni_mysql_backup.sh - mysql backups successful"
  exit 0
else
  echo "check_a2_omni_mysql_backup.sh - backup of the database ${FAILED_BCKP} failed"
  exit 2
fi