backupManager.sh
is a Bash script designed to manage backups for various local and remote
resources. The script provides options to backup specific directories, sync backups, and run all
backup tasks. It also includes a test mode to simulate the backup process with sample data.
- Backup specific directories from local and remote servers
- Synchronize local backups with a remote server
- Run all backup tasks in a single command
- Test mode to simulate backups with sample data
- Bash
- rsync
- ssh
- sudo
- Clone the repository:
git clone https://github.com/TituxMetal/backupManager.git
cd backupManager
- Make the script executable:
chmod +x backupManager.sh
To run the script in normal mode, simply execute:
./backupManager.sh
To run the script in test mode, which sets up a test environment and simulates the backup process with sample data, use the --test parameter:
./backupManager.sh --test
When you run the script, you will be prompted to select a backup task:
- Backup local AllDataZ to homelab
- Backup virt-manager
- Backup all servers
- Backup a specific server
- Sync local backups with homelab
- Run all backup tasks
Select the appropriate option by entering the corresponding number.
The script is configured to backup data from the following servers:
andrew
bart
lisa
laura
mary
homelab
You can modify the SERVERS
array in the script to include or exclude servers as needed.
The script backs up the following directories from each server:
/home
/srv
/etc
/var/lib/docker/volumes
/var/log
You can modify the directories
array in the backupServers
function to include or exclude
directories as needed.
printMessage
Prints a formatted message to the terminal.
handleError
Handles errors and exits the script if an error occurs.
createDir
Creates a directory.
populateDir
Populates a directory with sample data.
setupTestEnvironment
Sets up the test environment for the script by creating necessary directories and populating them with sample data.
backupAllDataZ
Backs up all data from localAllDataZ
to remoteHomelabAllDataZ
using rsync.
backupVirtManager
Backs up the virt-manager
directory using rsync.
backupServers
Backs up specified directories on a remote server using rsync.
syncBackups
Synchronizes backups from a local directory to a remote directory using rsync.
selectBackupTask
Displays a menu of backup tasks and performs the selected task based on user input.
This project is licensed under the MIT License. See the LICENSE file for details.
Titux Metal <tituxmetal[at]lgdweb[dot]fr>
Special thanks to the open-source community for providing the tools and resources that made this project possible.