Code Monkey home page Code Monkey logo

backupalerts's Introduction

Backup Alerts

A simple wrapper script for rclone to alert about backups

If you have a better name for this, feel free to open an issue with the name.


Requirements

System packages: python3 rclone

Python packages: requests

Installation

On Debian/Ubuntu based systems:

sudo apt update
sudo apt install python3 python3-pip rclone git
pip install requests
git clone https://github.com/TotallyMonica/BackupAlerts
chmod +x BackupAlerts/main.py

On RedHat/Fedora based systems:

sudo dnf install python3 python3-pip rclone git
pip install requests
git clone https://github.com/TotallyMonica/BackupAlerts
chmod +x BackupAlerts/main.py

Please note: this script has been untested on non-Linux based operating systems. Use at your own risk for non-Linux environments

Configuration

Prior to running, it is important that you configure the script correctly. Namely, there are two files you will want to create in the working folder of the script: options.json and secrets.json. Template scripts are provided in the repo or can be copied from the README

Template options.json:

{
  "operation": "",
  "direction": "",
  "remote": "",
  "source_path":  "",
  "flags": [""],
  "arguments": {
  },
  "exclusions": [""]
}

Template secrets.json

{
  "discord": {
    "webhook": ""
  },
  "homeassistant": {
    "server": "",
    "api_key": ""
  },
  "mail": {
    "sender": "",
    "recipients": ["", ""],
    "server": "",
    "port": 587,
    "protocol": "",
    "username": "",
    "password": ""
  }
}

Usage:

cd /path/to/script
./main.py

To-Do:

  • Add in Slack support
  • Test on Windows
  • Add in inclusion support
  • Mail integration: add in support for SSL/TLS
  • Better module detection and importing
  • Better error handling

Stretch goals include:

  • Configurable output for alerts
  • Show size of backup in alerts
  • Show amount of files backed up in alerts

Purpose

I use rclone to back up my computer to a Backblaze B2 bucket, but I was unsure if backups were being triggered or if they were successful. As such, I created this to send me notifications through a Discord webhook. After doing some more research, it was not that difficult to add in support for Home Assistant alerts. It further served as an opportunity for me to learn about sending emails from a script, which is where I receive most of my alerts to begin with.

backupalerts's People

Contributors

totallymonica avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.