Table of Contents
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⭐ !
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
: -
The second on are 2 Apps, git and jq, you can download them easily using the command:
sudo apt-get install git jq
The installation is fast (around 15 mins)
-
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
-
Edit the
get_chatid.sh
andtelegram_server_alert.sh
replace the telegram_bot_token with yours. -
Write the following commands:
chmod +x ./get_chatid.sh ./telegram_server_alert.sh
-
Start a conversation with the bot on your Telegram App and then start the
get_chatid.sh
script:./get_chatid.sh
-
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 -
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 -
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!
- Make it work
- Make a tutorial on my youtube channel
Elxss - discord: Eliasss#8886 - elxssgitcontact@gmail.com - website: elxss.github.io
This is a Readme.md Template