-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.sh
43 lines (34 loc) · 1.15 KB
/
utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# read configuration file
# source $HOME/.telegramrc
source /users_home/opa/visir-dev/.telegramrc_frame
####################################################
#
# Local conf
#
####################################################
TELEGRAM_ENABLED=1
####################################################
#
# Console/Telegram handler function: Notify
#
####################################################
Notify() {
local msgType=$1
local app=$2
local msg=$3
echo "[$APPNAME] $msg" 2>&1 | tee -a $LOGFILE
if [[ $msgType -eq 0 ]]; then
if [[ ${TELEGRAM_ENABLED} ]]; then
sh ${TELEGRAM_EXE} -t ${TELEGRAM_TOKEN} -c ${TELEGRAM_CHANNEL} "[$app] $(echo -e '\U0000274C') $msg"
fi
elif [[ $msgType -eq 1 ]]; then
if [[ ${TELEGRAM_ENABLED} ]]; then
sh ${TELEGRAM_EXE} -t ${TELEGRAM_TOKEN} -c ${TELEGRAM_CHANNEL} "[$app] $(echo -e '\U0001F7E2') $msg"
fi
elif [[ $msgType -eq 2 ]]; then
if [[ ${TELEGRAM_ENABLED} ]]; then
sh ${TELEGRAM_EXE} -t ${TELEGRAM_TOKEN} -c ${TELEGRAM_CHANNEL} "[$app] $(echo -e '\U00002699') $msg"
fi
fi
}