An open API service indexing awesome lists of open source software.

https://github.com/emadasefi/rsyncbackup

The rSyncBackup Bash script automates the backup process by utilizing rsync to transfer files from specified remote servers to local directories.
https://github.com/emadasefi/rsyncbackup

Last synced: 4 months ago
JSON representation

The rSyncBackup Bash script automates the backup process by utilizing rsync to transfer files from specified remote servers to local directories.

Awesome Lists containing this project

README

        

rSyncBackup Script (automating backups across multiple servers)
====================================
This Bash script automates the process of backing up files from specified remote servers to designated local directories using rsync. It includes logging capabilities for monitoring the backup operations and handles password authentication using sshpass.


## 🌟 Key Features


  • Automated Backup: The script facilitates automatic backups from specified remote servers to designated local directories, eliminating the need for manual intervention.


  • Efficient Transfer: Utilizing rsync, the script efficiently transfers files by only copying changed data, which minimizes bandwidth usage and speeds up the process.


  • Logging Capabilities: It logs essential information such as the start and end times of backup operations, along with any errors encountered during the process. This ensures that users can monitor and review backup activities effectively.


  • Archiving Previous Backups: To prevent data loss, the script archives previous backups with timestamps. This feature allows users to maintain historical versions of their data.



  • ## 🌟 Implementation Details


  • Prerequisites: The script requires bash, rsync, and sshpass for password authentication. It is also recommended to set up passwordless SSH access for seamless operation.


  • Scheduling: The script can be scheduled to run at regular intervals using a cron job, ensuring that backups are performed consistently without user input.


  • Error Handling: While basic logging is included, users are advised to implement additional error handling mechanisms to address potential issues during backup operations.


  • Usage Scenarios: The script can be adapted for various use cases, such as backing up web server files, databases, or personal data across different systems.

  • This automation not only enhances data security by ensuring regular backups but also simplifies the management of backup processes across multiple servers.



  • ## 💡 Configuration Section :
    ```shell
    declare -A SOURCE_SERVERS=(
    ["[email protected]:22:/backends"]="password11:/mnt/storage/backup/backends-11"
    ["[email protected]:2223:/etc/nginx"]="password12:/mnt/storage/backup/nginx-12"
    )

    ARCHIVE_BASE="/mnt/storage/backup/archive"
    LOG_DESTINATION="/mnt/storage/backup"
    CURRENT_DATE=$(date +"%Y-%m-%d_%H-%M-%S")
    ```



  • Associative Array: SOURCE_SERVERS holds the mapping of source server details (user, IP, port, and path) to their respective passwords and local backup destinations.


  • Directories: ARCHIVE_BASE is where previous backups are stored, and LOG_DESTINATION is where log files are saved.


  • Current Date: The current date and time are captured for use in logging and archiving.



  • ## 📜 Conclusion

  • This Bash script is a robust solution for automating backups across multiple servers while ensuring data integrity through archiving and comprehensive logging. By using tools like rsync and sshpass, it simplifies file transfers while managing passwords securely within a controlled environment.



  • ## — Feedback ❤️—
    Please leave a comment if you have any comments, suggestions or problems.