Skip to content

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.

License

Notifications You must be signed in to change notification settings

dhgatjeye/keephive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KeepHive

Backup daemon for Windows

Rust Platform

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.


Quick Start

1. Download

# Clone the repository
git clone https://github.com/dhgatjeye/keephive.git
cd keephive

# Build release binary
cargo build --release

2. Create Configuration

Create 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"
  }
}

3. Run

Console Mode (for testing):

keephive.exe keephive_config.json

Windows 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 --uninstall

πŸ“– Usage

Command Line Options

USAGE:
  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

βš™οΈ Configuration

Schedule Types

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

Log Rotation

Options: "daily", "hourly", "never"

{
  "log_rotation": {
    "type": "daily"
  }
}

Complete Configuration Example

{
  "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"
  }
}

File Locations

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)

πŸ› οΈ Development

Build from source

# Clean first
cargo clean

# Release build 
cargo build --release

Project Structure

keephive/
β”œβ”€β”€ 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

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages