Skip to content

Commit

Permalink
Merge pull request #4 from magicdrums/master
Browse files Browse the repository at this point in the history
Update multiple channelID or USERID
  • Loading branch information
vdeville authored May 8, 2019
2 parents bf2d971 + 37117cd commit 20d855d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions alert.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash

# Import credentials form config file
. /opt/ssh-login-alert-telegram/credentials.config

for i in "${USERID[@]}"
do
URL="https://api.telegram.org/bot${KEY}/sendMessage"
DATE="$(date "+%d %b %Y %H:%M")"

Expand All @@ -18,5 +19,6 @@ if [ -n "$SSH_CLIENT" ]; then
Date: ${DATE}
More informations: [${IPINFO}](${IPINFO})"

curl -s -d "chat_id=${USERID}&text=${TEXT}&disable_web_page_preview=true&parse_mode=markdown" $URL > /dev/null
curl -s -d "chat_id=$i&text=${TEXT}&disable_web_page_preview=true&parse_mode=markdown" $URL > /dev/null
fi
done
2 changes: 1 addition & 1 deletion credentials.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Your USERID or Channel ID to display alert and key, we recommend you create new bot with @BotFather on Telegram
USERID="none"
USERID=( USERIDn CHANNELIDn )
KEY="none"

0 comments on commit 20d855d

Please sign in to comment.