Giter VIP home page Giter VIP logo

systemd-telegram's Introduction

systemd-telegram - Telegram notifications for systemd units

Disclaimer: This project is not affiliated with systemd. The name may suggest it, but I just could not come up with something better.

This repository provides a script and systemd service to send notifications via Telegram after a unit completes.

Requirements

Installation

The script, as well as a systemd service, can be installed with the provided Makefile.

You may need root privileges to execute the Makefile. As with everything coming from the internet, please review the files before executing anything!

git clone https://github.com/lukasdietrich/systemd-telegram
cd systemd-telegram/
sudo make install

If you want to update, but not override the configuration, you can install only the script and systemd unit.

git pull
sudo make update

The Makefile creates backups when overriding files. If you wish to change that, you can set the BACKUP variable. See the documentation of install for further details.

sudo make update BACKUP=none

Configuration

To send notifications via Telegram you need a bot token and your personal chat_id. To create both, please see the documentation of the BotFather.

Once obtained, both secrets need to be configured in /usr/local/etc/systemd-telegram/telegram.env.

Using --user units

To send notifications with --user units, you need to add the above bot secrets (or a new pair) to ~/.config/systemd-telegram/telegram.env.

Send notifications on failure

To send a notification on failure (including the journal logs), you must create a drop-in for the service in question.

systemctl edit my-service.service

# [Unit]
# OnFailure=systemd-telegram@%n.service

Send notifications on success

If you want to send notifications on success, too, add another line with OnSuccess instead of OnFailure. Successful executions do not include journal logs.

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.