This Bash script manages database backups by utilizing mariadb-dump for backup creation. The script encrypts the backup with AES-256, transfers it to a remote server via FTP, deletes backups older than 7 days, and supports AES decryption.
- Prompt user for configuration values if they are missing.
- Load configuration values from a file if it exists.
- Save configuration values to a file if they don't exist already.
- Perform a database backup using
mariadb-dump. - Encrypt the backup file using AES-256.
- Transfer the encrypted backup file to a remote server using FTP.
- Delete old backup directories that are older than 7 days.
- Decrypts a file using AES encryption algorithm
- MariaDB command-line tools (
mariadb-dump) - OpenSSL (
openssl) - LFTP (
lftp)
- Make sure all the required tools are installed on your system.
- Download the
backup.shscript to a desired directory.
- Open a terminal and navigate to the directory where the
backup.shscript is located. - Run the script with the following command:
./backup.shThe script will prompt you for configuration values if they are missing and save them to a configuration file (config) for future use.
./decrypt.sh <filename> <decryption_key>
<filename>: The name of the encrypted file that needs to be decrypted.<decryption_key>: The key used for decryption.
This script is released under the MIT License.