20 lines
448 B
Bash
Executable File
20 lines
448 B
Bash
Executable File
#! /bin/sh
|
|
|
|
# Check if both monitor names are provided as arguments
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "Usage: $0 <message_to_send>"
|
|
exit 1
|
|
fi
|
|
|
|
# Set the API token and chat ID
|
|
API_TOKEN="$(cat .var/telegram_bot_api_token)"
|
|
CHAT_ID="$(cat .var/telegram_bot_chat_id)"
|
|
|
|
MESSAGE="$1"
|
|
|
|
# Use the curl command to send the message
|
|
curl -s -X POST https://api.telegram.org/bot$API_TOKEN/sendMessage -d chat_id=$CHAT_ID -d text="$MESSAGE" \
|
|
> /dev/null
|
|
|
|
|