#! /bin/sh API_URL="$(grep "API_URL=" /usr/local/bin/sendtelegram.config | cut -d= -f2)" SILENCE="$(grep "SILENCE=" /usr/local/bin/sendtelegram.config | cut -d= -f2)" CHAT_ID="$(grep "CHAT_ID=" /usr/local/bin/sendtelegram.config | cut -d= -f2)" THRD_ID="$(grep "THRD_ID=" /usr/local/bin/sendtelegram.config | cut -d= -f2)" TXT_MSG="[Authorization] $(cat /etc/hostname): $(w -h)" ( if [ -z "${THRD_ID}" ]; then curl -s -o /dev/null -X POST \ -d chat_id="${CHAT_ID}" \ -d text="${TXT_MSG}" \ -d disable_notification="${SILENCE}" \ "${API_URL}" else curl -s -o /dev/null -X POST \ -d chat_id="${CHAT_ID}" \ -d text="$TXT_MSG" \ -d disable_notification="${SILENCE}" \ -d message_thread_id="$THRD_ID" \ "${API_URL}" fi )