SafeSync is a robust and versatile backup script meticulously engineered to synchronize files and directories seamlessly between user-specified source and destination paths within the filesystem. Offering unparalleled flexibility, this tool ensures a user-friendly experience with its configuration driven by the config.json file. Users can effortlessly tailor their backup strategy by adjusting parameters such as backup intervals, exception files, and more. SafeSync's strength lies in its ability to provide comprehensive logging and exception handling, ensuring a reliable and efficient backup process. Specially designed not only for personal machines but also for professional-grade servers, SafeSync is the go-to tool for users seeking a dependable and customizable backup solution. Whether you are a casual user in need of a straightforward backup or a power user seeking a seamless and automated approach to data synchronization, SafeSync stands as the ultimate choice. Experience the convenience of file synchronization with SafeSync—your comprehensive solution for a seamless and personalized backup strategy.
-
Flexibility:
- SafeSync offers flexibility in defining source and destination paths, enabling users to tailor their backup configurations according to their specific needs.
-
User-Friendly Configuration:
- The tool utilizes a straightforward
config.json
file for configuration, making it easy for users to customize settings such as backup intervals, exception files, and more.
- The tool utilizes a straightforward
-
Logging and Exception Handling:
- SafeSync includes detailed logging functionality, recording both general logs and
rsync
operation details. It also provides the option to exclude specific file types during synchronization.
- SafeSync includes detailed logging functionality, recording both general logs and
-
Automated Synchronization:
- With the ability to schedule backups at defined intervals, SafeSync automates the synchronization process, ensuring regular updates and minimizing the risk of data loss.
-
Comprehensive Documentation:
- The project comes with a detailed README.md file, guiding users through the installation process, configuration steps, and providing insights into the directory structure and file descriptions.
-
Regular Data Backups:
- SafeSync is ideal for users who need a simple and efficient way to perform regular backups of their important files and directories.
-
Customized Backup Strategies:
- Users with specific requirements for backup intervals, file exclusions, and directory creation preferences can easily customize SafeSync to suit their needs.
-
Automated Synchronization:
- SafeSync's automated synchronization feature is beneficial for users who want a hands-free approach to keeping their data up-to-date.
SafeSync stands out as a reliable and user-friendly solution for users seeking a backup tool with flexibility, automation, and detailed logging capabilities. Whether you're a casual user looking for an easy way to safeguard your files or a power user with specific backup requirements for your servers, SafeSync provides a versatile and efficient solution.
└── SafeSync
├── LICENSE
├── README.md
├── config
│ ├── backup_list.txt
│ └── config.json
├── logs
│ ├── rsync.log
│ └── safesync.log
├── safesync.sh
└── src
├── essentials.sh
└── load_json_config.py
-
LICENSE: Contains the licensing information for the SafeSync tool.
-
README.md: The primary documentation file providing detailed information about the SafeSync tool, its configuration, and usage.
-
config:
- backup_list.txt: A crucial file specifying the source and destination paths for synchronization.
- config.json: Configuration file containing various settings for SafeSync, such as backup interval, exceptions, and more.
-
logs:
- rsync.log: Log file recording details of the
rsync
operation. - safesync.log: Log file capturing general logs from the SafeSync tool.
- rsync.log: Log file recording details of the
-
safesync.sh: The main script file responsible for executing the SafeSync tool.
-
src:
- essentials.sh: Script file containing essential functions and utilities used by SafeSync.
- load_json_config.py: A Python script for loading and processing the configuration from
config.json
.
To find the exact path of the files needed for configuration (backup_list.txt
and config.json
), navigate to the SafeSync
directory and access the config
subdirectory. The configuration files are located there:
cd SafeSync/config
Now, you can view or modify the contents of backup_list.txt
and config.json
for customizing the SafeSync tool according to your preferences.
If you need to access the log files generated by the SafeSync tool, follow the steps below to find the exact path to the log files:
-
rsync.log:
- The
rsync.log
file records details of thersync
operation. - The path to
rsync.log
is relative to theSafeSync
directory. - To access
rsync.log
, navigate to thelogs
subdirectory:You can then view or analyze the contents ofcd SafeSync/logs
rsync.log
using your preferred text editor or viewer.
- The
-
safesync.log:
- The
safesync.log
file captures general logs from the SafeSync tool. - Similar to
rsync.log
, the path tosafesync.log
is relative to theSafeSync
directory. - To access
safesync.log
, navigate to thelogs
subdirectory:Opencd SafeSync/logs
safesync.log
using your preferred text editor or viewer to review the tool's general logs.
- The
By following these steps, you can easily locate and access the log files generated by SafeSync for monitoring and troubleshooting purposes.
-
Bash Shell Environment: Ensure that your system has a Bash shell. You can check this by running:
echo $SHELL
If the output is
/bin/bash
or similar, you have a Bash shell. -
Python 3: SafeSync is tested on Python 3. So, if you don't have any constraints about maintaining a certain python version in your machine, you can choose to install Python3 using any method listed below. Otherwise, SafeSync should potentially work on any version of python.
-
On Debian/Ubuntu:
sudo apt-get install python3
-
On Red Hat/Fedora:
sudo dnf install python3
-
On macOS:
brew install python3
-
On Windows: Download and install Python 3 from the official Python website.
-
-
jq (JSON Processor) - OPTIONAL: SafeSync uses
jq
for JSON parsing. Install it using your package manager.-
On Debian/Ubuntu:
sudo apt-get install jq
-
On Red Hat/Fedora:
sudo dnf install jq
-
On macOS:
brew install jq
-
On Windows: Download and install
jq
from the official jq website.
-
-
Clone the Repository: Clone the SafeSync repository to your local machine.
git clone https://github.com/ajayagrawalgit/SafeSync.git
-
Navigate to the SafeSync Directory: Change to the SafeSync directory.
cd SafeSync
-
Configure
config.json
: Edit theconfig/config.json
file to customize SafeSync for your requirements. Refer to the providedconfig.json
template for guidance.{ "backup_interval": 10, "backup_list": "/path/to/backup_list.txt", "exceptions": [".xml", ".html", ".yaml"], "create_dirs": "true", "log_destination": "/path/to/logs/safesync.log", "rsync_log": "/path/to/logs/rsync.log", "python_command": "python3", "secure_backup_interval": 3600 }
-
backup_interval: The interval, in seconds, at which SafeSync will execute. Adjust this value to determine how frequently the backup process runs.
-
backup_list: Specify the location where
backup_list.txt
is stored. Provide the full path after cloning or downloading the repository. -
exceptions: Specify file extensions to exclude during synchronization. Modify the existing list as needed, adhering to the current format.
-
create_dirs: Set this to "true" to instruct SafeSync to create parent directories in the destination path mirroring the source structure. Use "false" if you only want to copy files within the existing destination without creating parent directories.
-
log_destination: Specify the location where
safesync.log
is stored. Provide the full path after cloning or downloading the repository. -
rsync_log: Define the location for the
rsync.log
file. Provide the full path after cloning or downloading the repository. -
python_command: Enter the command used to run Python scripts on your machine. Typically, this is either
python
orpython3
. Ensure accurate representation based on your system configuration. -
secure_backup_interval: This variable should be entered in seconds which specifies that if the source file is changed within this time since the script has started running, SafeSync will rename the same file in the destination path as backup and copy the fresh file with the original name to the destination. By default, it's 3600 seconds i.e. 1 hour.
-
-
Configure
backup_list.txt
:This file dictates the source and destination paths engaged in the synchronization process. Follow the specified format when inputting paths:
/complete/path/to/Source/directory_1 /complete/path/where_you_want_to_backup_directory_1/ie_destination_1 /complete/path/to/Source/directory_2 /complete/path/where_you_want_to_backup_directory_1/ie_destination_2 /complete/path/to/Source/directory_3 /complete/path/where_you_want_to_backup_directory_1/ie_destination_3
- Paths are separated by a tab.
- The initial segment represents the source, housing the original files and folders.
- The subsequent column, situated directly in front of the source path, designates the destination where the backup of the respective source will be stored.
-
Run SafeSync: Execute the SafeSync script to initiate the backup process.
./safesync.sh
This script reads the
config.json
file, performs backup tasks, and logs results.
- Monitor Log Files:
Check the log files (
safesync.log
andrsync.log
) for detailed information about the backup process, success, or failure.
-
Backup List File (
backup_list.txt
): Thebackup_list.txt
file should contain pairs of source and destination paths, separated by spaces, each pair on a new line./complete/path/to/Source/directory_1 /complete/path/where_you_want_to_backup_directory_1/ie_destination_1 /complete/path/to/Source/directory_2 /complete/path/where_you_want_to_backup_directory_1/ie_destination_2 /complete/path/to/Source/directory_3 /complete/path/where_you_want_to_backup_directory_1/ie_destination_3
-
Exception Handling: SafeSync excludes files with extensions specified in the
exceptions
array during the backup process. If you don't need any exceptions at all, just leave a blank array like[]
-
Directory Creation: The
create_dirs
flag determines whether SafeSync should create destination directories. -
Logging: Log files (
safesync.log
andrsync.log
) store detailed information about the backup process, including success and failure messages. So make sure you provide correct path for these logs.
Feel free to contribute to SafeSync by submitting issues or pull requests here.
This project is licensed under the MIT License.
Developer - Ajay Agrawal
- 🌌 Profile
- 🐦 Twitter Bot (@mickbotsays)