This guide explains how to use the Simple Backup Tool, a bash script that helps you back up web directories and MySQL databases with optional descriptions.
-
nano backup\_tool. Paste the script content and save (Ctrl+O, Enter, Ctrl+X). -
chmod +x backup\_tool.sh -
./backup\_tool.sh
-
Input:
-
Source Directory: Path to the folder you want to back up.
-
Destination Directory: Where the backup will be saved.
-
Filename: Default includes timestamp (e.g., web_backup_20240125_142022.tar.gz).
-
Description (Optional): Add notes about the backup.
-
-
Output:
-
A compressed .tar.gz backup file.
-
A README_*.txt file with details (if description was added).
-
-
Input:
-
MySQL Credentials: Username, password, and host (default: localhost).
-
Select Databases: Choose which databases to back up.
-
Filename: Default includes database name and timestamp (e.g., db_backup_mydb_20240125_142022.sql.gz).
-
Description (Optional): Add notes about the backup.
-
-
Output:
-
A compressed .sql.gz file for each database.
-
A README_*.txt file for each backup (if description was added).
-
-
./backup\_tool.sh -
Choose "Backup web directory?" (y).
-
Enter:
-
Source Directory: /var/www/mywebsite
-
Destination Directory: ~/backups
-
Filename: (Press Enter for default or type a custom name)
-
Description: (Optional) "Main website backup before updates"
-
✅ Output:
-
~/backups/web_backup_20240125_142022.tar.gz
-
~/backups/README_web_backup_20240125_142022.txt
-
./backup\_tool.sh -
Choose "Backup MySQL databases?" (y).
-
Enter:
-
MySQL Username: root
-
MySQL Password: (hidden input)
-
MySQL Host: (Press Enter for localhost)
-
Select Databases: Choose from the list (e.g., mydb).
-
Filename: (Press Enter for default or type a custom name)
-
Description: (Optional) "Production DB backup before migration"
-
✅ Output:
-
~/backups/db_backup_mydb_20240125_142022.sql.gz
-
~/backups/README_db_backup_mydb_20240125_142022.txt
Each backup generates a README file with:
-
Date & Time
-
Backup Name & Location
-
Size
-
Description (if provided)
Example README_*.txt:
Backup Information ================= Date: Fri Jan 25 14:20:22 UTC 2024 Backup Name: web_backup_20240125_142022.tar.gz Location: /home/user/backups Size: 245M Description: Main website backup before updates
**
"Directory doesn't exist!"
**Check the path and try again.
**"No databases found!"
**verify MySQL credentials and permissions.
Backup failsEnsure enough disk space in the destination.
**Script permission denied
**Run chmod +x backup\_tool.sh.
✔ Store backups securely (cloud/external drive).✔ Test restoring backups to ensure they work.✔ Use descriptions to remember why each backup was made.
Run the script and start backing up!
./backup_tool.sh