Automated backup solution for daily backups of:
C:\Projects(excluding venv and unnecessary files) →Z:\backup\ProjectsC:\Users\gleit\Desktop\start→Z:\backup\start
- Incremental Backups: SHA256 checksum-based file comparison for efficient backups
- Resume Capability: Checkpoint system allows resuming interrupted backups
- Network Resilience: Retry logic with exponential backoff for network failures
- Email Notifications: Gmail integration for backup completion and status alerts (optional)
- Health Monitoring: Backup freshness checks and status reporting
- Windows Task Scheduler: Automated daily execution
- Progress Tracking: Real-time progress tracking and detailed logging
- Pre-flight Checks: Validates system readiness before backup execution
- Python 3.8+
- Windows 10/11
- Z: drive mapped and accessible
- Gmail account (optional, for email notifications)
git clone https://github.com/auenbauer/backup_amd.git
cd backup_amdRun the initialization script:
.\init.ps1This will:
- Create a Python virtual environment
- Install all required dependencies
- Set up the project structure
# Create virtual environment
py -m venv venv
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# Install dependencies
pip install -r utils/requirements.txtCreate a .env file or set environment variables:
# Source and Destination Paths
SOURCE_PATH_PROJECTS=C:\Projects
SOURCE_PATH_START=C:\Users\gleit\Desktop\start
DESTINATION_PATH=Z:\backup
# Logging
LOG_DIR=logs
CHECKPOINT_FILE=checkpoints/backup_checkpoint.json
# Email Configuration (Optional)
EMAIL_RECIPIENT=your-email@gmail.com
USE_SMTP=false # Set to true for App Password authentication
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-passwordBy default, the following patterns are excluded:
venv/directories__pycache__/directories.git/directoriesnode_modules/directories.pytest_cache/directories
# Activate virtual environment first
.\venv\Scripts\Activate.ps1
# Run backup
python backup.py backuppython backup.py statusbackup/
├── state/ # Project state files
│ ├── plan.md # Project plan
│ ├── features.json # Feature tracking
│ └── progress.txt # Progress log
├── utils/ # Utilities
│ └── requirements.txt # Python dependencies
├── test/ # Test suites
├── src/ # Source code modules
├── scripts/ # Utility scripts
├── logs/ # Log files
├── checkpoints/ # Backup checkpoints
├── backup.py # Main entry point
├── init.ps1 # Initialization script
└── README.md # This file
# Activate virtual environment
.\venv\Scripts\Activate.ps1
# Run all tests
pytest test/ -vTo test email sending, you need Gmail credentials (App Password):
# Option 1: Command line arguments
py scripts/test_email_sending.py --email your-email@gmail.com --gmail-user your-gmail@gmail.com --app-password your-16-char-password
# Option 2: Environment variables
$env:TEST_EMAIL_TO="your-email@gmail.com"
$env:TEST_GMAIL_USER="your-gmail@gmail.com"
$env:TEST_GMAIL_APP_PASSWORD="your-16-char-password"
py scripts/test_email_sending.pyGetting Gmail App Password:
- Go to Google Account settings
- Enable 2-Step Verification
- Go to App Passwords section
- Generate App Password for "Mail"
- Use the 16-character password (spaces are OK)
Note: Unit tests mock email sending. The integration test (test/test_email_integration.py) requires credentials and will be skipped without them.
The system is designed to run on Windows with Task Scheduler:
# Setup scheduled tasks
py scripts/setup_scheduled_tasks.py
# Or generate XML files only
py scripts/setup_scheduled_tasks.py --generate-xml-onlyNote: This project is designed for Windows-specific deployment:
- Uses Windows Task Scheduler for automation
- Accesses Windows network drives (Z: drive)
- Uses Windows-specific paths and file systems
Docker deployment would require:
- Linux container with Samba/CIFS for network drive access
- Cron instead of Task Scheduler
- Path modifications for Linux filesystem
- Different credential storage mechanisms
Current Status: Not containerized - designed for native Windows deployment.
-
Setup Gmail Credentials:
- Place
token.picklein project root (for OAuth2) - Or configure SMTP with App Password
- Place
-
Configure Windows Task Scheduler:
- Run
py scripts/setup_scheduled_tasks.py - Backup runs daily at 2:00 AM
- Status check runs daily at 8:00 AM
- Run
-
Test Email Notifications:
- Run
py scripts/test_gmail_simple.py --email your-email@gmail.com - Verify all 4 email types work
- Run
-
Run First Backup:
py backup.py --email gleitold@gmail.com- Verify backup completes successfully
-
Monitor:
- Use
py scripts/backup_status_cli.py statusfor status - Check logs in
logs/directory
- Use
[Specify your license here]