add Telegram error notification

This commit is contained in:
pavel.muhortov 2023-02-11 22:30:06 +03:00
parent f878aa1676
commit 0df6924a87
5 changed files with 16 additions and 1 deletions

View File

@ -6,3 +6,6 @@ imgnames=point-01 point-02 point-04 point-05 point-11 point-12
xscale=1920 xscale=1920
yscale=1080 yscale=1080
mp4fps=25 mp4fps=25
telegramapiurl=https://api.telegram.org/bot1234567890:YOURAPIKEY
telegramchatid=123456789

View File

@ -1,7 +1,9 @@
#! /bin/bash #! /bin/bash
# #
## DESCRIPTION: JPEG to MP4 converter. ## DESCRIPTION:
# JPEG to MP4 converter.
# This is only a local "proof of conept" for testing and debugging.
# #
# #
@ -27,6 +29,7 @@ execquite() {
} }
execerror() { execerror() {
addtologs "error: $1" addtologs "error: $1"
curl -s -X POST $telegramapiurl/sendMessage -d chat_id=$telegramchatid -d text="error: $1" >> /dev/null 2>&1
execquite execquite
} }
getconfig() { getconfig() {
@ -37,6 +40,8 @@ getconfig() {
xscale=$(cat $conf | grep "xscale=" | cut -d= -f2) xscale=$(cat $conf | grep "xscale=" | cut -d= -f2)
yscale=$(cat $conf | grep "yscale=" | cut -d= -f2) yscale=$(cat $conf | grep "yscale=" | cut -d= -f2)
mp4fps=$(cat $conf | grep "mp4fps=" | cut -d= -f2) mp4fps=$(cat $conf | grep "mp4fps=" | cut -d= -f2)
telegramapiurl=$(cat $conf | grep "telegramapiurl=" | cut -d= -f2)
telegramchatid=$(cat $conf | grep "telegramchatid=" | cut -d= -f2)
} }
# #

View File

@ -32,6 +32,7 @@ execquite() {
} }
execerror() { execerror() {
addtologs "error: $1" addtologs "error: $1"
curl -s -X POST $telegramapiurl/sendMessage -d chat_id=$telegramchatid -d text="error: $1" >> /dev/null 2>&1
execquite execquite
} }
getconfig() { getconfig() {

View File

@ -15,3 +15,6 @@ tmppass=pass
tmpaddr=192.168.254.254 tmpaddr=192.168.254.254
tmpport=22 tmpport=22
tmpnode=28-1a2b3c4d5e6f tmpnode=28-1a2b3c4d5e6f
telegramapiurl=https://api.telegram.org/bot1234567890:YOURAPIKEY
telegramchatid=123456789

View File

@ -32,6 +32,7 @@ execquite() {
} }
execerror() { execerror() {
addtologs "error: $1" addtologs "error: $1"
curl -s -X POST $telegramapiurl/sendMessage -d chat_id=$telegramchatid -d text="error: $1" >> /dev/null 2>&1
execquite execquite
} }
getconfig() { getconfig() {
@ -49,6 +50,8 @@ getconfig() {
tmpaddr=$(cat $conf | grep "tmpaddr=" | cut -d= -f2) tmpaddr=$(cat $conf | grep "tmpaddr=" | cut -d= -f2)
tmpport=$(cat $conf | grep "tmpport=" | cut -d= -f2) tmpport=$(cat $conf | grep "tmpport=" | cut -d= -f2)
tmpnode=$(cat $conf | grep "tmpnode=" | cut -d= -f2) tmpnode=$(cat $conf | grep "tmpnode=" | cut -d= -f2)
telegramapiurl=$(cat $conf | grep "telegramapiurl=" | cut -d= -f2)
telegramchatid=$(cat $conf | grep "telegramchatid=" | cut -d= -f2)
} }
getairtmp() { getairtmp() {
local temp=$( \ local temp=$( \