diff --git a/alert.sh b/alert.sh index 0166b71..dcae5fc 100755 --- a/alert.sh +++ b/alert.sh @@ -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")" @@ -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 diff --git a/credentials.config b/credentials.config index 2686dc8..b26aea0 100644 --- a/credentials.config +++ b/credentials.config @@ -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"