From 85025303a1d9816d5ceb1b112f9a9946e09c6f83 Mon Sep 17 00:00:00 2001 From: spongle Date: Sat, 25 Jun 2022 18:35:43 +0100 Subject: [PATCH] . --- shared/_nmsg | 38 ++++++++++++++++++++++++++++++++++++++ shared/_tmsg | 36 ++++++++++++++++++++++++++++++++++++ shared/tmsg | 48 +++++++++++++++++++++++++----------------------- 3 files changed, 99 insertions(+), 23 deletions(-) create mode 100755 shared/_nmsg create mode 100755 shared/_tmsg diff --git a/shared/_nmsg b/shared/_nmsg new file mode 100755 index 0000000..b882d3f --- /dev/null +++ b/shared/_nmsg @@ -0,0 +1,38 @@ +#!/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 "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` + +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} + +curl -d "${SUBJECT} ${MSG}" ntfy.sh/hInfo \ No newline at end of file diff --git a/shared/_tmsg b/shared/_tmsg new file mode 100755 index 0000000..55405f9 --- /dev/null +++ b/shared/_tmsg @@ -0,0 +1,36 @@ +#!/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 "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` + +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} diff --git a/shared/tmsg b/shared/tmsg index 55405f9..a14984c 100755 --- a/shared/tmsg +++ b/shared/tmsg @@ -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 \ No newline at end of file