This commit is contained in:
2022-06-22 23:25:29 +01:00
commit a9b0c3f409
5 changed files with 203 additions and 0 deletions

33
shared/tmsg Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
if [ -d /zTools/zPrivateConfig/shared ] && [ ! -d /static ]
then
BASE=/zTools/zPrivateConfig/shared
fi
if [ ! -d /zTools/zPrivateConfig/shared ] && [ -d /static ]
then
BASE=/static
fi
if [ -f ${BASE}/shared/.telegramenv ]
then
. ${BASE}/shared/.telegramenv
else
echo "Environment file not found"
exit 1
fi
SCRIPT=$1
MSG=$2
MYNAME=`uname -n`
SUBJECT=" ${MYNAME} - ${SCRIPT}: "
DROP='{"chat_id": "'"${TCHATID}"'", "text": " '"${SUBJECT}"' '"${MSG}"'"}'
curl -X POST \
-H 'content-type: application/json' \
-d "${DROP}" \
https://api.telegram.org/bot${DUFUS}/sendmessage
rm -f ${MSG}