/Server-Startup-Telegram-Alert

Send a Telegram message on the startup of a Linux server.

Primary LanguageShellOtherNOASSERTION


Logo

Server Telegram Alert on Startup


View Demo - Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Installation
  3. Roadmap
  4. Contact

About The Project

Demo

Not home ? But you still wanna know when your server goes online No problem, this project is the answer to your issue.

This program runs on Linux ( Tested on Debian )

This program is oriented for people like me that are using remote relays to start their computers, However everyone can use it

This project is 100% written in Bash

The script works by simply sending a message through a webhook using the Telegram API. I chose to write it in Bash to consume as little performance as possible.

At first using the get_chatid.sh you will get the id of the chat between you and the bot you can add the bot to a group, it will work too. Then using the Chat ID you can Setup the core of the project telegram_server_alert.sh after the Chat ID placed in it, you are ready to go.

The whole setup of everything should take around 15mins.

If you like the project don't forget to leave a Star⭐ !

(back to top)

Prerequisites

To use this script, you will need 2 things:

  • a Telegram bot: creating a telegram bot is easy the only 2 things you need to do are to send a message to the account @BotFather:

    and configuring your bot with him:

    Bot Setup

  • The second on are 2 Apps, git and jq, you can download them easily using the command:

sudo apt-get install git jq 

Installation

The installation is fast (around 15 mins)

  1. Then write the following command to install the repo onto your server/computer:

    git clone https://github.com/Elxss/Server-Startup-Telegram-Alert.git

    dont forget to go in the directory using the command:

    cd Server-Startup-Telegram-Alert
  2. Edit the get_chatid.sh and telegram_server_alert.sh replace the telegram_bot_token with yours.

  3. Write the following commands:

    chmod +x ./get_chatid.sh ./telegram_server_alert.sh
  4. Start a conversation with the bot on your Telegram App and then start the get_chatid.sh script:

    ./get_chatid.sh
  5. Using the id that you got from the output of the get_chatid.sh script:

    Chat ID : 2581182769

    Edit the telegram_server_alert.sh replace the telegram_chat_id with yours

  6. Then you need to schedule this task at each startup. You can do this using the command crontab -e Select the Editor that you prefer Add the following ligne at the bottom of the file:

    @reboot /path/to/telegram_server_alert.sh

    You wan get the path using the command pwd when you are in the directory of the program

  7. Congrats! You just finished the setup of the program now at each startup you are gonna receive a message from your server Leave a star⭐ if you enjoy this project!

(back to top)

Roadmap

(back to top)

Contact

Elxss - discord: Eliasss#8886 - elxssgitcontact@gmail.com - website: elxss.github.io

(back to top)

This is a Readme.md Template