mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2025-01-14 18:09:48 +00:00
log interactvice/backgound start kill
This commit is contained in:
parent
35d5e05ea9
commit
344167e259
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user