Backup daemon for Windows
KeepHive is a backup daemon designed for Windows environments with a focus on ease of use. It runs as both a console application and a Windows Service, providing scheduled backups with automatic recovery and hot configuration reload.
# Clone the repository
git clone https://github.com/dhgatjeye/keephive.git
cd keephive
# Build release binary
cargo build --releaseCreate keephive_config.json:
{
"jobs": [
{
"id": "documents_backup",
"source": "C:\\Users\\user\\Documents",
"target": "D:\\Backups\\Documents",
"schedule": {
"type": "daily",
"hour": 2,
"minute": 0
},
"description": "Daily backup of Documents at 2 AM"
}
],
"retention_count": 10,
"log_level": "info",
"state_path": ".keephive_state.json",
"log_directory": "./logs",
"log_rotation": {
"type": "daily"
}
}Console Mode (for testing):
keephive.exe keephive_config.jsonWindows Service (for local):
## Run Terminal with Administrator
# Install service
keephive.exe --install C:\ProgramData\KeepHive\keephive_config.json
# Start service
keephive.exe --start
# Stop service
keephive.exe --stop
# Uninstall service
keephive.exe --uninstallUSAGE:
keephive.exe [CONFIG_FILE] Run in console mode
keephive.exe --install [CONFIG_FILE] Install as Windows Service
keephive.exe --uninstall Uninstall Windows Service
keephive.exe --start Start Windows Service
keephive.exe --stop Stop Windows Service
keephive.exe --help Show help
Interval - Run every N seconds:
{
"schedule": {
"type": "interval",
"seconds": 3600
}
}Daily - Run at specific time every day:
{
"schedule": {
"type": "daily",
"hour": 2,
"minute": 30
}
}Weekly - Run on specific day of week:
{
"schedule": {
"type": "weekly",
"day": 7,
"hour": 3,
"minute": 0
}
}Note: day 1 = Monday, 7 = Sunday
Options: "daily", "hourly", "never"
{
"log_rotation": {
"type": "daily"
}
}{
"jobs": [
{
"id": "work_files",
"source": "C:\\Work",
"target": "D:\\Backups\\Work",
"schedule": {
"type": "interval",
"seconds": 3600
},
"description": "Hourly backup of work files"
},
{
"id": "photos",
"source": "C:\\Users\\Me\\Pictures",
"target": "D:\\Backup",
"schedule": {
"type": "weekly",
"day": 7,
"hour": 1,
"minute": 0
},
"description": "Weekly photo backup on Sunday at 1 AM"
}
],
"retention_count": 5,
"log_level": "info",
"state_path": "C:\\ProgramData\\KeepHive\\keephive_state.json",
"log_directory": "C:\\ProgramData\\KeepHive\\logs",
"log_rotation": {
"type": "daily"
}
}Console Mode:
- Config:
./keephive_config.json(or specified path) - State:
./keephive_state.json(or as configured) - Logs:
./logs(or as configured)
Service Mode:
- Config:
C:\ProgramData\KeepHive\keephive_config.json(recommended) - State: Same directory as config (or as configured)
- Logs: Same directory as config (or as configured)
# Clean first
cargo clean
# Release build
cargo build --releasekeephive/
βββ src/
β βββ main.rs # Entry point
β βββ lib.rs # Library exports
β βββ config/ # Configuration management
β βββ core/ # Backup logic
β βββ scheduler/ # Job scheduling
β βββ state/ # State management
β βββ service/ # Service daemon
β βββ platform/windows/ # Windows-specific code
β βββ observability/ # Logging
βββ Cargo.toml # Dependencies