A Rust-based file system monitor that automatically triggers restic backups when changes are detected in configured directories.
- Real-time file system monitoring with automatic backup triggers
- Configurable throttling to prevent backup storms
- YAML-based configuration
- Comprehensive logging (both terminal and file-based)
- Automatic stale lock removal
- Support for multiple watch directories with individual settings
- Rust (latest stable version)
- restic backup utility installed and configured
- A configured restic repository
# Clone the repository
git clone https://github.com/N0ne1eft/restic-automator-rs
cd restic-automator-rs
# Build the project
cargo build --release
Create a config.yml
file with the following structure:
repo: "your-restic-repository-path"
exclude-file: "path-to-exclude-file"
password-command: "command-to-get-repository-password"
logfile: "path-to-logfile"
restic-path: "path-to-restic-binary"
dirs:
- name: "backup-job-name"
path: "/path/to/watch"
throttle: 60 # Delay in seconds before triggering backup after changes
# Add more directories as needed
- name: "another-backup"
path: "/another/path"
throttle: 120
repo
: Your restic repository path (local path or remote URL)exclude-file
: Path to the file containing patterns to exclude from backuppassword-command
: Command that outputs your repository passwordlogfile
: Path where logs will be writtenrestic-path
: Path to the restic binarydirs
: List of directories to monitorname
: Unique name for the backup jobpath
: Directory path to monitorthrottle
: Delay in seconds before triggering a backup after changes are detected
# Run with default config.yml in current directory
./restic-automator-rs
# Run with custom config file
./restic-automator-rs /path/to/config.yml
The application logs both to the terminal and to the specified log file. Logs include:
- Backup initiation and completion
- Number of new and changed files
- Backup duration
- File system monitoring status
- Error messages and warnings
# Debug build
cargo build
# Release build
cargo build --release
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.