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

44
shared/tfile Executable file
View File

@ -0,0 +1,44 @@
#!/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
FILETOSEND=$3
MYNAME=`uname -n`
MSG=/var/tmp/${THIS_SCRIPT}.msg.$$
#if [ -e ${ERROR} ]
# then
# echo "---error_log_start" >> ${MSG}
# cat ${ERROR} >> ${MSG}
# echo "---error_log_finish" >> ${MSG}
SUBJECT=" ${MYNAME} - ${SCRIPT}: "
cat ${FILETOSEND} > ${MSG}.txt
FILE='document=@'"${MSG}.txt"
curl -X POST \
-F ${FILE} \
-F "chat_id=${TCHATID}" \
-F "caption=${SUBJECT} ${MSG}" \
https://api.telegram.org/bot${DUFUS}/sendDocument
rm -f ${MSG}