This commit is contained in:
2022-06-25 18:35:43 +01:00
parent a29fbd010f
commit 85025303a1
3 changed files with 99 additions and 23 deletions

View File

@ -1,36 +1,38 @@
#!/bin/sh
if [ -d /zTools/zPrivateConfig/shared ] && [ ! -d /static ]
if [ -d /zTools/zPrivateConfig ] && [ ! -d /static ]
then
BASE=/zTools/zPrivateConfig/shared
BASE=/zTools/zPrivateConfig
fi
if [ ! -d /zTools/zPrivateConfig/shared ] && [ -d /static ]
if [ ! -d /zTools/zPrivateConfig ] && [ -d /static ]
then
BASE=/static
fi
if [ -f ${BASE}/shared/.telegramenv ]
then
. ${BASE}/shared/.telegramenv
else
echo "Created ${BASE}/shared/.telegramenv"
echo "Please update contents and rerun"
echo "DUFUS="" " > ${BASE}/shared/.telegramenv
echo "TCHATID="" " >> ${BASE}/shared/.telegramenv
exit 1
fi
# if [ -f ${BASE}/shared/.telegramenv ]
# then
# . ${BASE}/shared/.telegramenv
# else
# echo "Created ${BASE}/shared/.telegramenv"
# echo "Please update contents and rerun"
# echo "DUFUS="" " > ${BASE}/shared/.telegramenv
# echo "TCHATID="" " >> ${BASE}/shared/.telegramenv
# exit 1
# fi
SCRIPT=$1
MSG=$2
MYNAME=`uname -n`
# SCRIPT=$1
# MSG=$2
# MYNAME=`uname -n`
SUBJECT=" ${MYNAME} - ${SCRIPT}: "
# 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
# 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}
# rm -f ${MSG}
${BASE}/shared/_nmsg $1 $2