Last active
November 3, 2018 16:50
-
-
Save lucarin91/ab5dca257e9560c087b8ff238ae544f4 to your computer and use it in GitHub Desktop.
Send a telegram message when something happens on a remote server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### | |
# Send message to your telegram chat when something happens to a remote server. | |
# Before use the sript update the TOKEN and CHAT_ID variable with your data. | |
# | |
# Usage: | |
# tsend 'ALL DONE!' | |
# cat myfile.txt | tsend | |
# | |
# license: MIT | |
# created-by: lucarin91 | |
### | |
TOKEN=671384880:AAHl9elaskdjlaksdjalksjdddbsVrw0 | |
CHAT_ID=234444 | |
URL="https://api.telegram.org/bot$TOKEN/sendMessage" | |
MESSAGE=$@ | |
if [ -z "$MESSAGE" ] ; then | |
read MESSAGE > /dev/null | |
fi | |
curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$MESSAGE" > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment