Simple-Backup
A lightweight, configurable backup tool for creating local archives of your important files. This tool creates compressed backups on your local filesystem that can be easily transferred to external storage or cloud services.
Overview
Simple-Backup provides:
- Configurable backup sources and destinations
- Support for both TAR (high compression) and ZIP (faster) archive formats
- Pattern-based file exclusion
- Cross-platform compatibility on Linux systems
Installation
You can install Simple-Backup system-wide to run it from anywhere:
# Clone the repository
git clone https://github.com/yourusername/simple-backup.git
cd simple-backup
# Run the setup script
./setup.sh
The setup script will either:
- Create a symlink in
/usr/local/binif you have write permissions - Prompt you to run with sudo if needed
- Offer to add the directory to your PATH in ~/.bashrc
After installation, you can run the backup command from any directory.
Configuration
The configs/ directory contains JSON configuration files for your backup jobs. The repository includes an example config file (example-config.json) that you can use as a template.
Important: All config files except
example-config.jsonare ignored by git. This allows you to have different configurations on different machines without affecting other installations.
To get started, copy the example file to create your own configuration:
# Copy example to create your own config
cp configs/example-config.json configs/my-backup.json
# Edit your new config file with your favorite editor
nano configs/my-backup.json
Each configuration file should include:
| Field | Description |
|---|---|
outputDir |
Directory where backups will be saved (supports ~ for home directory) |
inputs |
List of directories/files to back up |
ignorePatterns |
List of patterns to exclude from backup |
archiveType |
Either "tar" (default, higher compression) or "zip" (faster, better compatibility) |
remoteLocation |
Optional. Remote location for backup copy using scp format (e.g., user@host:~/path) |
Example configuration:
{
"outputDir": "~/backups/",
"inputs": [
"~/Documents/",
"~/Pictures/"
],
"ignorePatterns": [
".git/",
"node_modules/"
],
"archiveType": "zip",
"remoteLocation": "user@remotehost:~/backups/"
}
Running
You can run backups manually or as a scheduled task:
Manual Execution
# Once installed, simply run:
backup
# Or from the repository directory:
./backup.py
When executed, the script will process all JSON files in the configs/ directory (except the example file), creating backups as specified in each configuration. If no valid config files are found, it will provide instructions for creating one.
Scheduled Execution (Linux)
Add a cron job to run backups automatically, for example weekly on Saturday at 1:05 AM:
sudo crontab -e
# Add this line:
5 1 * * 6 /path/to/simple-backup/backup.py >> /var/log/simple-backup.log 2>&1
Exclude Patterns
The exclusion system uses simple string matching:
- Patterns are matched against the full file path
- No regex or glob syntax is supported
- For directories, adding a trailing slash (e.g.,
.git/) will exclude the directory and all its contents
Remote Backup
With the optional remoteLocation setting, Simple-Backup can automatically:
- Check if the remote server is accessible
- Ensure the target directory exists on the remote server
- Copy the backup file via SCP after local backup completes
This requires:
- SSH key-based authentication set up between your local and remote machines
- The remote server must be accessible via SSH
- You must have write permissions to the specified remote directory
If the remote copy fails for any reason, the local backup will still be preserved.
What's Next?
If not using the remote backup feature, you'll need to manually copy your backups to external storage or cloud services like Proton Drive, Google Drive, or Dropbox for off-site backup.