From 344167e259f4e5dfec1ba4b01135ea78b91fe2c7 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Thu, 18 Jun 2020 12:39:07 +0200 Subject: [PATCH] log interactvice/backgound start kill --- bashbot.sh | 2 +- doc/0_install.md | 2 +- modules/background.sh | 9 ++++++--- modules/sendMessage.sh | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bashbot.sh b/bashbot.sh index e91779a..c189081 100755 --- a/bashbot.sh +++ b/bashbot.sh @@ -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-dev-38-g215667b +#### $$VERSION$$ v0.98-dev-39-g35d5e05 # # Exit Codes: # - 0 sucess (hopefully) diff --git a/doc/0_install.md b/doc/0_install.md index c27ab9e..9187dfe 100644 --- a/doc/0_install.md +++ b/doc/0_install.md @@ -107,5 +107,5 @@ The old format is supported for backward compatibility, but may fail for corner #### [Next Create Bot](1_firstbot.md) -#### $$VERSION$$ v0.98-dev-38-g215667b +#### $$VERSION$$ v0.98-dev-39-g35d5e05 diff --git a/modules/background.sh b/modules/background.sh index 6bf092d..6076f39 100644 --- a/modules/background.sh +++ b/modules/background.sh @@ -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-dev-27-gb33132e +#### $$VERSION$$ v0.98-dev-39-g35d5e05 # will be automatically sourced from bashbot @@ -41,8 +41,9 @@ killproc() { # $3 jobname # $4 $5 parameters start_back() { - #local fifo; fifo="${DATADIR:-.}/$(procname "$1")" - printf '%s\n' "$1:$3:$2" >"${DATADIR:-.}/$(procname "$1")$3-back.cmd" + local cmdfile; cmdfile="${DATADIR:-.}/$(procname "$1")$3-back.cmd" + printf "%s: Start background job CHAT=%s JOB=%s CMD=%s\n" "$(date)" "${1}" "${cmdfile##*/}" "${2} ${4} ${5}" >>"${UPDATELOG}" + printf '%s\n' "$1:$3:$2" >"${cmdfile}" restart_back "$@" } restart_back() { @@ -59,6 +60,7 @@ start_proc() { [ -z "$2" ] && return [ -x "${2%% *}" ] || return 1 local fifo; fifo="${DATADIR:-.}/$(procname "$1")" + printf "%s: Start interacitve script CHAT=%s FIFO=%s CMD=%s\n" "$(date)" "${1}" "${fifo##*/}" "${2} ${3} ${4}" >>"${UPDATELOG}" kill_proc "$1" mkfifo "${fifo}" nohup bash -c "{ $2 \"$4\" \"$5\" \"$fifo\" | \"${SCRIPT}\" outproc \"${1}\" \"${fifo}\" @@ -95,6 +97,7 @@ kill_proc() { fifo="$(procname "$1" "$2")" prid="$(proclist "${fifo}")" fifo="${DATADIR:-.}/${fifo}" + printf "%s: Stop interacitve / background CHAT=%s FIFO/JOB=%s\n" "$(date)" "${1}" "${fifo##*/}" >>"${UPDATELOG}" # shellcheck disable=SC2086 [ -n "${prid}" ] && kill ${prid} [ -s "${fifo}.log" ] || rm -f "${fifo}.log" diff --git a/modules/sendMessage.sh b/modules/sendMessage.sh index 17c6cba..5144b2f 100644 --- a/modules/sendMessage.sh +++ b/modules/sendMessage.sh @@ -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-dev-38-g215667b +#### $$VERSION$$ v0.98-dev-39-g35d5e05 # will be automatically sourced from bashbot