more places with debug_checks

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-28 08:52:02 +02:00
parent 0e6712a599
commit 4b3363f603
2 changed files with 9 additions and 6 deletions

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.98-pre2-11-ge6de382
#### $$VERSION$$ v0.98-pre2-13-g0e6712a
#
# Exit Codes:
# - 0 success (hopefully)
@ -81,10 +81,10 @@ debug_checks(){
local DATE WHERE MYTOKEN; DATE="$(date)"; WHERE="${1}"; shift
printf "%s: debug_checks: %s: bashbot.sh %s\n" "${DATE}" "${WHERE}" "$*"
MYTOKEN="$(getConfigKey "bottoken")"
[ -z "${MYTOKEN}" ] && printf "%s: %s\n" "${DATE}" "Bot token is missing!"
check_token "${MYTOKEN}" || printf "%s: %s\n" "${DATE}" "Invalid bot token!"
[ -z "$(getConfigKey "botadmin")" ] && printf "%s: %s\n" "${DATE}" "Bot admin is missing!"
[ -f ".jssh" ] && printf "%s: %s\n" "${DATE}" "Ups, found file \"${PWD:-.}/.jssh\"!"
[ -z "${MYTOKEN}" ] && printf "%s: %s\n" "${DATE}" "Bot token is missing! =========="
check_token "${MYTOKEN}" || printf "%s: %s\n" "${DATE}" "Invalid bot token! =========="
[ -z "$(getConfigKey "botadmin")" ] && printf "%s: %s\n" "${DATE}" "Bot admin is missing! =========="
[ -f ".jssh" ] && printf "%s: %s\n" "${DATE}" "Ups, found file \"${PWD:-.}/.jssh\"! =========="
} >>"${DEBUGLOG}"
# get location and name of bashbot.sh
@ -347,6 +347,7 @@ killallproc() {
# shellcheck disable=SC2046
[ -n "${procid}" ] && kill $(proclist -9 "$1")
fi
debug_checks "end killallproc" "${1}"
}

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.98-pre2-0-ga597303
#### $$VERSION$$ v0.98-pre2-13-g0e6712a
# will be automatically sourced from bashbot
@ -134,6 +134,7 @@ job_control() {
proc="${job#*:}"
job="${job%:*}"
fifo="$(procname "${CHAT}" "${job}")"
debug_checks "start job_control" "${1}" "${FILE}"
case "$1" in
"resumeb"*|"backgr"*)
printf "Restart Job: %s %s\n" "${proc}" " ${fifo}"
@ -160,6 +161,7 @@ job_control() {
# send message only onnfirst job
ADM=""
done
debug_checks "end job_control" "${1}"
# kill all requestet. kill ALL background jobs, even not listed in data-bot-bash
[ "${killall}" = "y" ] && killallproc "back-"
}