Skip to content

A collection of PowerShell scripts and utilities to help monitor and manage RClone synchronization operations with automated email reporting.

Notifications You must be signed in to change notification settings

Corp-i1/rClone-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

RClone Monitoring Scripts

A collection of PowerShell scripts and utilities to help monitor and manage RClone synchronization operations with automated email reporting.

Overview

This project provides a solution for running RClone bisync operations and monitoring their results through email notifications. The scripts handle synchronization, logging, error detection, and automated reporting to keep you informed of your backup status.

Features

  • Automated Bisync Operations: Configurable sync tasks for multiple directories
  • Email Log Monitoring: Daily email summaries with HTML formatting
  • Error Detection: Automatic detection and highlighting of errors in logs
  • Log Archiving: Automatic compression and archiving of log files
  • Web Dashboard: Optional web interface for RClone management
  • Customizable Filtering: Exclude specific files and folders from sync

Files Description

Scripts

  • rCloneMRunner.ps1 – Main script for running regular bisync operations (Run once as Admin to set up event trigger)
  • rCloneMRunner_Resync.ps1 – Script for running bisync with --resync flag (initial sync or recovery)
  • SendRcloneLogs.ps1 – Email notification script that processes and sends log summaries
  • rcloneStartupDashboard.cmd – Batch file to start RClone web dashboard (optional)

Configuration

  • filters/rCloneDesktopFilter.txt – Filter file to exclude specific file types from sync
  • logs/ – Directory for storing log files and archived logs

Setup Instructions

1. Prerequisites

  • RClone installed and configured with your cloud storage provider
  • PowerShell 5.1 or later
  • Windows Credential Manager for storing email credentials
  • SMTP access for email notifications (Gmail example provided)

2. Installation

  1. Clone or download this repository to your desired location
  2. Update the configuration variables in each script (see Configuration section)
  3. Set up your email credentials in Windows Credential Manager
  4. Configure RClone with your cloud storage provider
  5. Run the main runner script (rCloneMRunner.ps1) as Administrator once to set up the event that triggers the email sender
  6. Test the scripts individually before scheduling

3. Configuration

Note: You can use any email provider as long as they have a SMTP service that you can use

Update Script Paths and Settings

In rCloneMRunner.ps1 and rCloneMRunner_Resync.ps1:

$rcloneExe = "C:\rclone\rclone.exe"
$logDir = "C:\rclone\logs"

$syncTasks = @(
    @{
        Remote = "remote:YourBucket"
        Local = "C:\Users\YourUser"
        LogFile = Join-Path $logDir "bisync_Pictures_files.txt"
        ExtraArgs = @("--create-empty-src-dirs")
    }
    # Add more sync tasks as needed
)

In SendRcloneLogs.ps1:

$LogDirectory = "C:\rclone\logs"
$smtpServer = "smtp.gmail.com"
$smtpUsername = "your-email@gmail.com"
$fromAddress = "your-email@gmail.com"
$toAddress = "your-email@gmail.com"

In rcloneStartupDashboard.cmd (optional):

C:\rclone\rclone.exe rcd --rc-web-gui --rc-serve --rc-user your-username --rc-pass your-password --rc-web-gui-update --rc-web-gui-no-open-browser

Set Up Email Credentials

Store your email credentials securely using Windows Credential Manager:

cmdkey /add:"GmailSMTP" /user:"yourgmail@gmail.com" /pass:"your-app-password"

Or via GUI:

  • Control Panel → Credential Manager → Windows Credentials → Add a Generic Credential
  • Target: GmailSMTP
  • Username: your-email@gmail.com
  • Password: your-app-password

Note: Gmail requires an App Password instead of your regular password: https://support.google.com/accounts/answer/185833?hl=en

Usage

Manual Execution

# Regular sync
.\scripts\rCloneMRunner.ps1

# Resync (for initial sync or recovery)
.\scripts\rCloneMRunner_Resync.ps1

# Send log summary email
.\scripts\SendRcloneLogs.ps1

# Start web dashboard (optional)
.\scripts\rcloneStartupDashboard.cmd

Scheduled Execution

🕒 Automate with Windows Task Scheduler

Depending on where your rclone exe is located as well as your scripts you may want to check the "Run with highest privileges" button.

You may also want to check the "Run whether user is logged on or not" for each task depending of prefrence.
The Backup
  1. Open Task Scheduler

  2. Click Create Task

  3. Name it: RClone Main Runner

  4. Trigger: Daily, set time (e.g., 6:00 PM)

  5. Action: Start a program

    • Program/script: powershell.exe

    • Add arguments:

      -NoProfile -ExecutionPolicy RemoteSigned -File "C:\rclone\scripts\rCloneMRunner.ps1" 
      
  6. Click Finish

    Under Conditions, uncheck "Start task only if the computer is on AC power" if on a laptop. Under Settings, you may want to check "Run task as soon as possible after a scheduled start is missed"

Emailing

In Task Scheduler, click Create Task

Go to Triggers → New…

Begin the task: On an event

Set up like this:

Log: Application

Source: RClone

Event ID: 1001

In Actions, add:

Program: powershell.exe

Arguments:

    -NoProfile -ExecutionPolicy RemoteSigned -File "C:\rclone\scripts\SendRcloneLogs.ps1" (>> "C:\rclone\logs\MailLog.txt" 2>&1 (optional for login the script - remove this text and brackets to use)) 

Under Conditions, uncheck "Start task only if the computer is on AC power" if on a laptop.
Under Settings, you may want to check "Run task as soon as possible after a scheduled start is missed"

Email Reports

The email notification system provides:

  • HTML summaries with green/red highlights
  • Error detection (e.g. failed, denied, fatal)
  • 📎 ZIP attachments of raw logs
  • 🧹 Archived logs to prevent disk bloat
  • 🔍 Filtered output (removes clutter like "bisync is in BETA")

Customization

Add New Sync Tasks

In rCloneMRunner.ps1 and rCloneMRunner_Resync.ps1:

@{
    Remote = "remote:Bucket/NewFolder"
    Local = "C:\Users\You\NewFolder"
    LogFile = Join-Path $logDir "bisync_NewFolder_files.txt"
    ExtraArgs = @("--create-empty-src-dirs", "--exclude", "*.tmp")
}

Filter Configuration

Edit filters/rCloneDesktopFilter.txt to exclude undesired files. Example excludes .url and .lnk files.

Error Keyword Customization

Update SendRcloneLogs.ps1:

$ErrorKeywords = "error|fail|denied|fatal|critical|warning"

Troubleshooting

  • ✉️ Email not sending: Check SMTP server, credentials, or firewall
  • 🔗 Sync issues: Confirm RClone paths and credentials
  • 🔒 Access denied: Run PowerShell as Admin once
  • 📂 No logs: Ensure correct directory and file naming

Security Notes

  • Use Windows Credential Manager for secure credential storage but keep in mind that this will not keep your app passowrd or similar safe if someone on your machine really wants it, but is better than pasting it on a random script you found online.
  • Avoid syncing private system or game files as they may contain large amounts of data that could increase costs (filter wisely)

Contributing

Feedback, issues, or PRs welcome! Help make the scripts better for others.

License

Open for personal/educational use. Modify and redistribute as needed — no warranty included.


Reminder: Test thoroughly before production use. Maintain backups at all times.

About

A collection of PowerShell scripts and utilities to help monitor and manage RClone synchronization operations with automated email reporting.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published