From 7b8e39147960bcd0bf32050d3139ba38ff4c6860 Mon Sep 17 00:00:00 2001 From: "Kay Marquardt (Gnadelwartz)" Date: Tue, 2 Mar 2021 18:05:14 +0100 Subject: [PATCH] bin: process_batch: fix options bashbot.rc: support webhook --- bashbot.rc | 41 ++++++++++++++++++++++++++++++++--------- bin/process_batch.sh | 16 +++++++++++----- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/bashbot.rc b/bashbot.rc index f0f1ad4..3e31c48 100755 --- a/bashbot.rc +++ b/bashbot.rc @@ -5,7 +5,7 @@ # # tested on: ubuntu, opensuse, debian # -#### $$VERSION$$ v1.45-dev-59-ga9ac7ea +#### $$VERSION$$ v1.45-dev-60-g2415814 # shellcheck disable=SC2009 # shellcheck disable=SC2181 @@ -34,11 +34,14 @@ runas="nobody" # runcmd="runuser ${runas} -s /bin/bash -c " # runasuser with *runuser* # edit the values of the following lines to fit your config: -# your bot installation dir -bashbotdir="/usr/local/telegram-bot-bash" -bashbot="cd ${bashbotdir}; ${bashbotdir}/bashbot.sh" # your bot name as given to botfather, e.g. mysomething_bot name="" +# your bot installation dir +bashbotdir="/usr/local/telegram-bot-bash" +databotdir="${bashbotdir}/data-bot-bash" +# programs to run +bashbot="cd ${bashbotdir}; ${bashbotdir}/bashbot.sh" +webhook="cd ${bashbotdir}; ${bashbotdir}/bin/process_batch.sh --start --watch ${databotdir}/webhook-fifo-${name}" # set additionl parameter, e.g. debug mode="" @@ -53,25 +56,45 @@ case "$1" in $runcmd "$bashbot start $mode" # >/dev/null 2>&1 /dev/null 2>&1 /dev/null' EXIT HUP QUIT +trap 'kill $(jobs -p) 2>/dev/null; printf "Bot in batch mode killed!\n"' EXIT HUP QUIT # use tail to read appended updates # shellcheck disable=SC2086,SC2248